Check for null values in string, if no values, print blank

Hi 
I posted a question a few days back, after playing with functions I was able to resolve it, I just have one more problem, if the string comes empty, only blank spaces should be printed, following is my string and my fix: 
My string: 
SEV.ORI/999999.VIN/1D7Hx11111111111111.VYR/2005.VMA/DODG.VMO/THU.DOT/07072013.CRT/MI1111111.OCA/11111111890123000001.LIT/PC.LIC/BFK9331
=Left(Split(Fields!MESSAGE.Value,"/")(6),2) + "/" 
& Mid(Split(Fields!MESSAGE.Value, "/")(6) ,3 ,2) + "/" 
& Mid(Split(Fields!MESSAGE.Value, "/")(6), 5, 4)
With this I get: 07/07/2013
If DOT comes empty, i get .CRT/
So I need to validate for empty space on DOT and print blank spaces. I'm guessing it would be with an IIF
or IsNothing function. Any help would be appreciated. 

Hi
Again after a few hours of playing with functions I resolved the issue, I will post the fix in case it can help someone else. 
String: 
M00836Z911134.SEV.ORI/MI3987656.VIN/1XXXXXXXXXXXXXX88.VYR/XXXX.VMA/FORD.VMO/THU.DOT/01192013.CRT/MIXX11XX0.OCA/XXXXXXXXXX123000XXX.LIT/PC.LIC/XXXXXXX.
Function: 
=IIF(Mid(Split(Fields!MESSAGE.Value, ".")(7) ,1 ,3) = "DOT" , Mid(Split(Fields!MESSAGE.Value, ".")(7) ,5 ,2) + "/" 
+ Mid(Split(Fields!MESSAGE.Value, ".")(7) ,7 ,2) + "/"
+ Mid(Split(Fields!MESSAGE.Value, ".")(7) ,9 ,4)," ")
Result: 
01/19/2013
If DOT is missing, the space in the report comes blank 

Similar Messages

  • 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

  • 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.

  • 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 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.

  • 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.

  • 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

  • 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

  • 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 ? <...> : <...>

  • How to check for null value of output parameter?

    Hi guys, I get a test procedure with 2 output parameters and do nothing:
    CREATE OR REPLACE PACKAGE BODY p_parameters_test AS
      PROCEDURE p_null_output_basetype(p1 OUT NUMBER,p2 OUT VARCHAR2)
      AS
      BEGIN
        DBMS_OUTPUT.PUT_LINE('DO NOTHING');
      END p_null_output_basetype;
    END;And I have below C# code:
    cmd.CommandText = "p_parameters_test.p_null_output_basetype";
    OracleParameter p1 = new OracleParameter("p1", OracleDbType.Decimal, System.Data.ParameterDirection.Output);
    OracleParameter p2 = new OracleParameter("p2", OracleDbType.Varchar2, System.Data.ParameterDirection.Output);
    cmd.Parameters.Add(p1);
    cmd.Parameters.Add(p2);
    try
        conn.Open();
        cmd.ExecuteNonQuery();
        if (p1.Value==null)
            Console.WriteLine("p1.Value==null");
        else if (Convert.IsDBNull(p1.Value))
            Console.WriteLine("Convert.IsDBNull(p1.Value)");
        else
            Console.WriteLine("p1 else "+p1.Value);
        if (p2.Value==null)
            Console.WriteLine("p2.Value==null");
        else if (Convert.IsDBNull(p2.Value))
            Console.WriteLine("Convert.IsDBNull(p2.Value)");
        else
            Console.WriteLine("p2 else "+p2.Value);
        Console.WriteLine("finished");
    catch......The output of it is:
    p1 else null
    p2 else null
    Does anyone have any idea why it always goes to the 'else' of the condition-branching, and how can I check if the output parameter is null?
    Thanks in advance.

    Morven... I ran into similar problems. Maybe you've found a solution of your own by now, but here's what I've learned...
    The Value property of output parameters, like p1 and p2 in your code, actually varies, according to (I think) the OracleDbType of the parameter. You've got OracleDbType.Decimal for p1 and OracleDbType.Varchar2 for p2. These look about right, since they match the parameter types in your actual stored procedure.
    After cmd.ExecuteNonQuery() executes, the respective Value properties of p1 and p2 are actually of different types. For p1, it's going to be "OracleDecimal" and for p2 it's "OracleString". Keep in miind that these are the types of the Value property of the OracleParameter objects, not the OracleParameter objects themselves.
    OracleDecimal and OracleString (and some other types like OracleDate, etc.) have an "IsNull" property you can use if you cast the Value property to its runtime type...
    if ((OracleDecimal)cmd.Parameters["p1"].Value).IsNull) { …do something… }
    else { …do something else… }
    Or maybe something like this...
    Decimal p1val = ((OracleDecimal)cmd.Parameters["p1"].Value).IsNull ? 0 : ((OracleDecimal)cmd.Parameters["AVG_SALARY"].Value).Value;
    I'll admit that expressions like this: ((OracleDecimal)cmd.Parameters["AVG_SALARY"].Value).Value look a little weird. But the "Value" of the "OracleDecimal" property is a regular .NET decimal type (System.Decimal). So, it's a "Value" of the "Value" property of the OracleParameter class.
    Even when the stored procedure returns a null, the Value property is still populated. In the case of p1, it's populated with an OracleDecimal object (actually a struct) where IsNull is true. That's why "p1.Value==null" tests false.
    From what I can see, OracleDecimal, OracleString, etc. will never be typed as DbNull, or DBNull.Value. So, that would be why Convert.IsDBNull(p1.Value)) always returns false. btw, it appears that these are Value types. That would suggest that coding something like like this, should be avoided…
    OracleString p2val = ((OracleString)cmd.Parameters["p2"].Value;
    if (p2val.IsNull) { …do something… }
    else { …do something else… }
    By assigning the value to another variable, you’d be actually creating an entire copy of the OracleString structure, which is pointless.
    I hope that helps
    Edited by: 897674 on Jan 3, 2012 10:44 AM
    Edited by: 897674 on Jan 3, 2012 10:46 AM

  • Check for NULL value (Recordset field)

    Hi y'all...
    A little question, so just for the weekend...
    I've a query that returns 4 fields, the fisrt three always containing data, and the last one an integer, or NULL. If I get the value with <i>rs.Fields.Item(3).Value.ToString();</i> it always contains an integer. The NULL values are always converted to '0'.
    How can I check if it is a NULL value?

    Okey, found a workaround, using the SQL function ISNULL()...
    SELECT ISNULL(U_MyVar, 'null_value') FROM [@MyTable]
    Now I can check if the value has the value <i>"null_value"</i>. If so, that field was <i>null</i>

  • Check for null value for Date Field

    Hello everyone,
    I have a database that consist of date field and also a bean that will able to access the db.
    here are my example:-
    private int setDate(int date) {
    this.date = date;
    private void getDate {
    return date;
    later, I entered a date value and wanna check whether the date is on the database or not. SO, do you all have any idea?

    Perhaps before passing your date off to a primitive int, you could pass it to an [Integer] object. Then check to see if that object is null;
    Integer d = new Integer(int value);
    if (d == null) {
    }

Maybe you are looking for

  • How can I disable the "allow" bar?

    Whenever I click on a link within a window to go to another site, the (what I call it) the "allow" bar shows up and will not let me continue until I click on the allow. Tonight I tried to access my local library and was constantly shown this bar when

  • Problem in moving the data into final internal table

    Hello all, I am stuck in apeculair situation. I have a internal table having header record and a internal table having its line items. Header record ::    90006103  A   20080110   ALBERTA    3456 Detail   record ::    90006103  D2  2219CR1710441     

  • ALV using three tables

    Hi frnz,           I have to create a alv report using 1 header table, and two item tables.              But we can use  reuse_alv_hireseq_list only for two tables . so i cant' this function.               Can anybody send me sample code to create al

  • Adding a check box to OTL Time Card Page in Time Card Matrix

    Hi, My requirement is: A check box should be placed on each timecard row on the left hand side I used hxczzhxclayt0082.ldt to make some changes to the Time Card matrix Can I add a check box using the same .ldt file Please Help Its Urgent

  • Adjusting the timeout for web services

    Dear All, I created a web service using se80. It's execution may be longer than 60 s. Is there a way I can adjust the timeouts of the web service, say extend it to 10 minutes? Thanks, Philon