Check for null and empty - Arraylist

Hello all,
Can anyone tell me the best procedure to check for null and empty for an arraylist in a jsp using JSTL. I'm trying something like this;
<c:if test="${!empty sampleList}">
</c:if>
Help is greatly appreciated.
Thanks,
Greeshma...

A null check might not be you best option.  If your requirement is you must have both the date and time component supplied in order to populate EventDate, then I would use a Script Functoid that takes data and time as parameters.
In the C# method, first check if either is an empty string, if so return an empty string.
If not, TryParse the data, if successful, return a valid data string for EventDate.  If not, error or return empty string, whichever satsifies the requirement.

Similar Messages

  • Check for null or empty in the functoid

    I want to check for null and empty values on input source node. If there exists a null or empty in the input source node, I should not pass that to output destination node. Does the
    following attachment work? I want to check for null or empty in the date and time and then concatenate them to send to output. If any of them is null or empty, the other should not fail. In the Not Equal Functoid I am checking for blank, but how to check for
    null?

    A null check might not be you best option.  If your requirement is you must have both the date and time component supplied in order to populate EventDate, then I would use a Script Functoid that takes data and time as parameters.
    In the C# method, first check if either is an empty string, if so return an empty string.
    If not, TryParse the data, if successful, return a valid data string for EventDate.  If not, error or return empty string, whichever satsifies the requirement.

  • Checking for null value in arraylist

    Hi
    i have an excel file which i i am reading into an arraylist row by row but not necesarrily that all columns in the row mite be filled. So how do i check for null values in the array list.
    try
                        int cellCount = 0;
                        int emptyRow = 0;
                        HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(file));
                        HSSFSheet sheet = workbook.getSheetAt(0);
                        Iterator rows = sheet.rowIterator(); 
                        myRow = new ArrayList();
                        int r = 1;
                             while (rows.hasNext())
                                  System.out.println("Row # " + r);
                                  HSSFRow row = (HSSFRow) rows.next();
                                  Iterator cells = row.cellIterator();          
                                  cellCount = 0;
                                  boolean isValid = false;
                                  while (cells.hasNext())
                                       HSSFCell cell = (HSSFCell) cells.next();
                                       switch (cell.getCellType())
                                            case HSSFCell.CELL_TYPE_NUMERIC:
                                                 double num = cell.getNumericCellValue();     
                                                 DecimalFormat pattern = new DecimalFormat("###,###,###,###");     
                                                 NumberFormat testNumberFormat = NumberFormat.getNumberInstance();
                                                 String mob = testNumberFormat.format(num);               
                                                 Number n = null;
                                                 try
                                                      n = pattern.parse(mob);
                                                 catch ( ParseException e )
                                                      e.printStackTrace();
                                                 System.out.println(n);
                                                 myRow.add(n);                                             
                                                 //myRow.add(String.valueOf(cell.getNumericCellValue()).trim());
                                                 //System.out.println("numeric: " +cell.getNumericCellValue());
                                                 break;
                                            case HSSFCell.CELL_TYPE_STRING:
                                                 myRow.add(cell.getStringCellValue().trim());
                                                 System.out.println("string: " + cell.getStringCellValue().trim());
                                                 break;
                                            case HSSFCell.CELL_TYPE_BLANK:
                                                 myRow.add(" ");
                                                 System.out.println("add empty:");
                                                 break;
                                       } // end switch
                                       cellCount++;
                                  } // end while                    
                                  r++;
                             }// end while
                   } myRow is the arrayList i am adding the cells of the excel file to. I have checked for blank spaces in my coding so please help with how to check for the black spaces that has been added to my arraylist.
    I have tried checking by looping through the ArrayList and then checking for null values like this
    if(myRow.get(i)!=null)
      // do something
    // i have tried this also
    if(myRow.get(i)!="")
    //do something
    }Edited by: nb123 on Feb 3, 2008 11:23 PM

    From your post I see you are using a 3rd party package to access the Excel SpreadSheets, you will have to look in your API for you 3rd party package and see if there is a method that will identify a blank row, if there is and it does not work, then you have to take that problem up with them. I know this is a pain, but it is the price we pay for 3rd party object use.
    In the mean time, you can make a workaround by checking every column in your row and seeing if it is null, or perhaps even better: check and see if the trimmed value of each cell has a lenth of 0.

  • Need To Check For Nulls And Force A Date

    I'm trying to check to see if a field is blank (null or blank), if so, force a date into it.  My formula is giving me zeros.  What is wrong with the below formula ?
    If {Sales_Primary.Type_Of_Sale} = 1  And
       Isnull()  Then 1999-01-01

    My bad. I don't think Date Time fields have "empty strings" but rather 0's instead.
    Try replacing the ="" with =0
    If {Sales_Primary.Type_Of_Sale} = 1 And
    (Isnull({TableName.Sales_Date}) OR {TableName.Sales_Date} = 0) Then #1/1/1999#
    Or you could simply try it without the "OR {TableName.Sales_Date} = 0" and see what you get.
    If {Sales_Primary.Type_Of_Sale} = 1 And
    Isnull({TableName.Sales_Date}) Then #1/1/1999#
    Jason

  • VARCHAR2:: How to differnciate between NULL and empty string '' ?

    Hello to all,
    I'm looking for a possibility to differnciate between NULL and empty string '' in column of type VARCHAR2.
    I have an application relying on that there is a difference between NULL and ''.
    Is it possible to configure ORACLE in some way ?
    Thanx in advance,
    Thomas

    try check if a varchar variable has an empty string
    by checking its lengthAnd that would accomplish what? But see for yourself:
    DECLARE
      v_test VARCHAR2(10);
    BEGIN
      v_test := '';
      DBMS_OUTPUT.put_line(LENGTH(v_test));
      v_test := NULL;
      DBMS_OUTPUT.put_line(LENGTH(v_test));
    END; C.

  • How does APEX check for null values in Text Fields on the forms?

    Hello all,
    How does APEX check for null values in Text Fields on the forms? This might sound trivial but I have a problem with a PL/SQL Validation that I have written.
    I have one select list (P108_CLUSTER_ID) and one Text field (P108_PRIVATE_IP). I made P108_CLUSTER_ID to return null value when nothing is selected and assumed P108_PRIVATE_IP to return null value too when nothign is entered in the text field.
    All that I need is to validate if P108_PRIVATE_IP is entered when a P108_CLUSTER_ID is selected. i.e it is mandatory to enter Private IP when a cluster is seelcted and following is my Pl/SQL code
    Declare
    v_valid boolean;
    Begin
    IF :P108_CLUSTER_ID is NULL and :P108_PRIVATE_IP is NULL THEN
    v_valid := TRUE;
    ELSIF :P108_CLUSTER_ID is NOT NULL and :P108_PRIVATE_IP is NOT NULL THEN
    v_valid := TRUE;
    ELSIF :P108_CLUSTER_ID is NOT NULL and :P108_PRIVATE_IP is NULL THEN
    v_valid := FALSE;
    ELSIF :P108_CLUSTER_ID is NULL and :P108_PRIVATE_IP is NOT NULL THEN
    v_valid := FALSE;
    END IF;
    return v_valid;
    END;
    My problem is it is returning FALSE for all the cases.It works fine in SQL Command though..When I tried to Debug and use Firebug, I found that Text fields are not stored a null by default but as empty strings "" . Now I tried modifying my PL/SQL to check Private_IP against an empty string. But doesn't help. Can someone please tell me how I need to proceed.
    Thanks

    See SQL report for LIKE SEARCH I have just explained how Select list return value works..
    Cheers,
    Hari

  • Page Validation - Function Returning Boolean - Check for NULL

    I have 3 Page Validations which all fire on "When Button Pressed" = "Submit".
    <br><br>
    Number 1 is of type "Item specified is NOT NULL" for "P199_BUSINESS_UNIT1".
    <br>
    Number 2 is of type "Item specified is NOT NULL" for "P199_BUSINESS_UNIT2".
    <br>
    Number 3 is of type "Function Returning Boolean" and has the following code:
    <br><br>
    IF :P199_BUSINESS_UNIT1 IS NULL   AND
       :P199_BUSINESS_UNIT2 IS NULL  THEN
        RETURN FALSE ;
    ELSE
        RETURN TRUE  ;
    END IF ;<br>
    When P199_BUSINESS_UNIT1 is NULL and P199_BUSINESS_UNIT2 is NOT NULL, I get the Error from Validation 1. Perfect.
    <br>
    When P199_BUSINESS_UNIT1 is NOT NULL and P199_BUSINESS_UNIT2 is NULL, I get the Error from Validation 2. Perfect.
    <br>
    When P199_BUSINESS_UNIT1 is NOT NULL and P199_BUSINESS_UNIT2 is NOT NULL, I don't get an Error Message. Perfect.
    <br><br>
    When P199_BUSINESS_UNIT1 is NULL and P199_BUSINESS_UNIT2 is NULL, I get Error Message 1 & 2, <strong>but nothing from 3.</strong>
    <br><br>
    If I change the code to:
    <br><br>
    IF :P199_BUSINESS_UNIT1 = '01'   AND
       :P199_BUSINESS_UNIT2 = '01'  THEN
        RETURN FALSE ;
    ELSE
        RETURN TRUE  ;
    END IF ;<br>
    and change both values to '01', I get the appropriate Error Message.
    <br><br>
    What is going on? Is there some reason I can't check for NULL in a Function Returning Boolean?

    Scott,
    <br><br>
    Instead of adding the Validations, I changed my code from:
    <br><br>
    IF :P199_BUSINESS_UNIT1 IS NULL   AND
       :P199_BUSINESS_UNIT2 IS NULL  THEN
        RETURN FALSE ;
    ELSE
        RETURN TRUE  ;
    END IF ;
    <br>to the following and got the desired results:
    <br><br>
    IF  REPLACE(:P199_BUSINESS_UNIT1,<strong>'%null'</strong> || '%',NULL) IS NULL   AND
        REPLACE(:P199_BUSINESS_UNIT2,<strong>'%null'</strong> || '%',NULL) IS NULL  THEN
        RETURN FALSE ;
    ELSE
        RETURN TRUE  ;
    END IF ;<br>
    Note that I changed the word REPLACE to upper case and the second occurrence of the word NULL to upper case to accentuate the fact that the '%null' is case sensitive, using "%NULL' does not work, it has to be "%null' in lower case.
    <br><br>
    <strong>Thanks for your help.</strong>

  • How do I check for null date entires using custom JScript on a SharePoint NewForm.aspx?

    Hi,
    I have the below JScript:
    /*Function to convert the US Date format to UK date format */
    function parseDate(input) {
    var parts = input.split('/');
    // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])
    return new Date(parts[2], parts[1]-1, parts[0]); // months are 0-based
    /*Function to check if end date is before the start date */
    function checkDates(){
    var sd = parseDate($("input[title='From']").val());
    var ed = parseDate($("input[title='Until']").val());
    if(sd > ed) {
    alert("Please check From and Until Date");
    $("input[value$='Save']").attr('disabled', true); //hide save button
    else
    $("input[value$='Save']").attr('disabled', false); //show save button
    The above works fine for checking sd > ed but I can't seem to check for null's, I have attempted the below which doesn't work:
    /*Function to convert the US Date format to UK date format */
    function parseDate(input) {
    var parts = input.split('/');
    // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])
    return new Date(parts[2], parts[1]-1, parts[0]); // months are 0-based
    /*Function to check if end date is before the start date */
    function checkDates(){
    var sd = parseDate($("input[title='From']").val());
    var ed = parseDate($("input[title='Until']").val());
    if( (sd > ed) || (sd == null) || (ed == Null) ) {
    alert("Please check From and Until Date");
    $("input[value$='Save']").attr('disabled', true); //hide save button
    else
    $("input[value$='Save']").attr('disabled', false); //show save button
    Any help appreciated.

    Hi aspnet-scotland,
    Please post ASP.NET related questions in
    ASP.NET forums where you could receive better responses.
    Thanks for your understanding.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • ViewCriteriaRow attribute to check for null or not null

    I Want to apply a view criteria to check for null or not null on a column , i see examples on how to set for value like
    vcRow.setAttribute("Sal", "> 2500")but i need to check for Sal is null or not null ,
    tried vcRow.setAttribute("Sal", null) and it is not working
    and vcRow.setAttribute("Sal", "is null") gives me error .
    can somebody help with correct syntax for this
    Thanks for your time

    looks like vcRow.setAttribute("Sal", "null") works

  • How to check for null values in bpel?? Please Help! very urgent!!!

    Hello Guys,
    I have a problem. I have an external webservice to which I have to post my request. My task is to create an Webservice and Service Assembly to which others would post request and get response. I have to create SA to deploy onto the bus.
    The problem is that there are optional elements in the request and response xsd's. In the Response sometimes certain feilds may come or they may not. for Example:- my response could contain a tag like this <firstName></firstName>
    I have to copy these feilds in my bpel process from one variable to another.(like in the mapper).
    My Question is , Is there any way in BPEL process or BPEL mapper where I could Check for null values in the request or response???
    Your inputs would be very helpful.
    Thanks
    Rajesh

    Thanks for replying man :)
    Ok I will be more clear.
    Here is a snippet of one of the xsd's that I am using.
    <xs:element name="returnUrl" nillable="false" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation>Partner specifies the return URL to which responses need to be sent to, in case of
    Async message model.
    </xs:documentation>
                        </xs:annotation>
                        <xs:simpleType>
                             <xs:restriction base="xs:anyURI">
                                  <xs:maxLength value="300"/>
                                  <xs:whiteSpace value="collapse"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:element>
    This means that the return URL field can be there or it may not be there. But if it is there it cant be null because nillable=false. But the whole <returnURL> </returnURL> can be there or it may not be there because minOccurs=0.
    My requirement is , if returnURL is there in the response with a value, then in my BPEL mapper I should map it else I should not map it.
    Thats the issue.
    and Yes kiran, the node be non-existant.
    So can you please help me with this.
    Thanks
    Rajesh

  • Check for null in IF statement

    Hi,
    I have a variable of type char(8).
    I want to check if this field is empty. This is the logic I use right now:
    condense lv_date no-gaps.
    if lv_date eq ''.
    *then some default value
    endif.
    Is this the correct approach or there is a way to directly check for null values in a variable.
    Thanks,
    CD

    Hello,
    You have to check IS INITIAL.
    condense lv_date no-gaps.
    if lv_date IS INITIAL.
    *then some default value
    endif.
    BR,
    Suhas

  • My MacBook Pro is running VERY slow. I am constantly getting pop-ups and now I got one that says my computer may be infected. What do I do to check for viruses and or remove them if there is one?

    What do I do to check for viruses and or remove them if there is one? I have never had a problem with my mac until now. It is running VERY slow

    This is what it came up with.... any ideas?
    EtreCheck version: 1.9.11 (43) - report generated May 27, 2014 at 11:07:36 PM CDT
    Hardware Information:
              MacBook Pro (15-inch, 2.53GHz, Mid 2009)
              MacBook Pro - model: MacBookPro5,4
              1 2.53 GHz Intel Core 2 Duo CPU: 2 cores
              4 GB RAM
    Video Information:
              NVIDIA GeForce 9400M - VRAM: 256 MB
    System Software:
              OS X 10.9.3 (13D65) - Uptime: 1 day 23:26:50
    Disk Information:
              Hitachi HTS545025B9SA02 disk0 : (250.06 GB)
                        EFI (disk0s1) <not mounted>: 209.7 MB
                        Macintosh HD (disk0s2) / [Startup]: 249.2 GB (20.75 GB free)
                        Recovery HD (disk0s3) <not mounted>: 650 MB
              MATSHITADVD-R   UJ-868 
    USB Information:
              Apple Inc. Built-in iSight
              Apple Internal Memory Card Reader
              Apple Inc. Apple Internal Keyboard / Trackpad
              Apple Computer, Inc. IR Receiver
              Apple Inc. BRCM2046 Hub
                        Apple Inc. Bluetooth USB Host Controller
    Gatekeeper:
              Anywhere
    Kernel Extensions:
              [not loaded] com.rim.driver.BlackBerryUSBDriverInt (0.0.39) Support
              [not loaded] com.rim.driver.BlackBerryUSBDriverVSP (0.0.39) Support
    Problem System Launch Daemons:
              [failed] com.apple.wdhelper.plist
    Launch Daemons:
              [loaded] com.adobe.fpsaud.plist Support
    User Launch Agents:
              [loaded] com.adobe.ARM.[...].plist Support
              [loaded] com.macpaw.CleanMyMac.helperTool.plist Support
              [loaded] com.macpaw.CleanMyMac.trashSizeWatcher.plist Support
              [loaded] com.macpaw.CleanMyMac.volumeWatcher.plist Support
              [running] com.whitesmoke.uploader.plist Support
    User Login Items:
              iTunesHelper
              AdobeResourceSynchronizer
    Internet Plug-ins:
              JavaAppletPlugin: Version: 14.9.0 - SDK 10.7 Check version
              FlashPlayer-10.6: Version: 13.0.0.214 - SDK 10.6 Support
              Default Browser: Version: 537 - SDK 10.9
              AdobePDFViewerNPAPI: Version: 11.0.06 - SDK 10.6 Support
              AdobePDFViewer: Version: 11.0.06 - SDK 10.6 Support
              Flash Player: Version: 13.0.0.214 - SDK 10.6 Support
              QuickTime Plugin: Version: 7.7.3
              Silverlight: Version: 5.1.10411.0 - SDK 10.6 Support
              iPhotoPhotocast: Version: 7.0
    Safari Extensions:
              WhiteSmoke: Version: 1.0.0.1
              Vidx: Version: 2.0
              DivX Plus Web Player HTML5 <video>: Version: 2.1.2.145
    Audio Plug-ins:
              BluetoothAudioPlugIn: Version: 1.0 - SDK 10.9
              AirPlay: Version: 2.0 - SDK 10.9
              AppleAVBAudio: Version: 203.2 - SDK 10.9
              iSightAudio: Version: 7.7.3 - SDK 10.9
    iTunes Plug-ins:
              Quartz Composer Visualizer: Version: 1.4 - SDK 10.9
    User Internet Plug-ins:
              Move-Media-Player: Version: npmnqmp 071801000001 Support
              fbplugin_1_0_1: Version: (null) Support
    3rd Party Preference Panes:
              Flash Player  Support
    Time Machine:
              Time Machine not configured!
    Top Processes by CPU:
                  12%          DashboardClient
                   6%          coreaudiod
                   6%          WindowServer
                   5%          repair_packages
                   3%          VLC
    Top Processes by Memory:
              549 MB          repair_packages
              143 MB          com.apple.WebKit.WebContent
              131 MB          Safari
              119 MB          installd
              94 MB          mds_stores
    Virtual Memory Information:
              809 MB          Free RAM
              1.82 GB          Active RAM
              224 MB          Inactive RAM
              630 MB          Wired RAM
              3.66 GB          Page-ins
              207 MB          Page-outs

  • Can't check for nulls in a conditional?

    Hey everyone. Trying my hand at a text based game but I'm encountering many problems:
    I have this method in one class that (as you can see) has a conditional that checks to see if 'check' is null, this throws a null pointer exception whenever it is called.
    private void placeChars()
            String check = currentItem.getItemString();
            if(check.equals(null) && currentRoom.getShortDescription().equals("in the cafeteria"))
                josh.getSentence(0);
        }Here is the method that it is calling from:
    public String getItemString()
            String returnString = null;
            if(haveItems != 0 ){
            returnString = "Items:";
            Set<String> keys = items.keySet();
            for(String item : keys) {
                returnString += " " + item;
        return returnString;
        }I'm not sure what I am doing wrong here :/ and yes I know the code is extremely ugly :)

    if check is null, you can't invoke any methods on it, including equals.
    To check for null:
    if (check == null)

  • Checking for nulls

    I have a string variable and I need to check for null.
    What is the best way to do this?
    Thanks.

    You can also do it like this:
    } catch (NullPointerException e) {or like this:
    s==null ? <...> : <...>

  • Null and empty string not being the same in object?

    Hello,
    I know that null and empty string are interpreted the same in oracle.
    However I discovered the strange behaviour concerning user defined objects:
    create or replace
    TYPE object AS OBJECT (
    value VARCHAR2(2000)
    declare
    xml xmltype;
    obj object;
    begin
    obj := object('abcd');
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    obj.value := '';
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    obj.value := null;
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    end;
    When creating xml from object, all not-null fields are transformed into xml tag.
    I supposed that obj.value being either '' or null will lead to the same result.
    However this is output from Oracle 9i:
    <OBJECT_ID><VALUE>abcd</VALUE></OBJECT_ID>
    <OBJECT_ID><VALUE></VALUE></OBJECT_ID>
    <OBJECT_ID/>
    Oracle 10g behaves as expected:
    <OBJECT><VALUE>abcd</VALUE></OBJECT>
    <OBJECT/>
    <OBJECT/>
    However Oracle 9i behaviour leads me to the conclusion that oracle
    must somehow distinguish between empty string and null in user defined objects...
    Can someone clarify this behaviour?
    Thus is it possible to test if object's field is empty or null?

    However Oracle 9i behaviour leads me to the conclusion that oracle
    must somehow distinguish between empty string and null in user defined objects...
    Can someone clarify this behaviour?
    Thus is it possible to test if object's field is empty or null?A lot of "fixes" were done, relating to XML in 10g and the XML functionality of 9i was known to be buggy.
    I think you can safely assume that null and empty strings are treated the same by Oracle regardless. If you're using anything less than 10g, it's not supported any more anyway, so upgrade. Don't rely on any assumptions that may appear due to bugs.

Maybe you are looking for

  • How do I set up Mail service for simple IMAP with SSL?

    This should be easy but something isn't working. I have an Xserve with 10.6. I've enabled the Mail service, and want to add this server as an Account under Entourage. I've put in the IP address, my username/password, etc. but something isn't working.

  • Report output in TXT format BOXI3.1

    Our requirement is to save the report in txt format. Currently we are using BOXI 3.1and using the option of CSV to convert it into TXT format. This lead to addtional overhead of removing headers and modfiying the delimiters. Is there any option avaia

  • The Best Chart Tool?

    I looking for a chart tool to use in jsp and export chart to image format (gif or jpg). This lib must have direct connect to db by jdbc. Somebody knows which one can be the best choice?. Any suggest are welcome?

  • Setting Pricing Condition Type Mandatory & Optional

    Hi, We have a requirement that a Condition Type in a Pricing procedure has to be set mandatory (Required) in general, but for certain materials ( Say with Mat. grp X etc ), this condition type with the same procedure has to be made Optional. Is there

  • 64 bits: why should I use it?

    Just for the sake of discussion: If I have a program offered in 32 and 64 bit modes, why should I use the 64 bit version? For example, the well known Videolan Player, aka VLC Media Player, recently updated to version 1.0.2, comes in 32 an 64 bit flav