How to handle blank dates

In my cfform, the user can select a starting and ending date
to search, a text field to search, or both the dates and text field
to search. Here is what I have :
<tr>
<td align="center" colspan="2">
<font size="3" face="Arial, Helvetica, sans-serif"
color="003366">
<b>From Date:</b></font>
<input type="text" size=11 name="fromDate_value"
value="">
<a
href="javascript:show_calendar4('document.getPSDocs.fromDate_value',
document.getPSDocs.fromDate_value.value)">
<img src="calendar.gif" width="25" height="25" border="0"
alt="Click here to Date Stamp"></a>
<font size="3" face="Arial, Helvetica, sans-serif"
color="003366">
<b>To Date:</b></font>
<input type="text" size=11 name="toDate_value"
value="">
<a
href="javascript:show_calendar4('document.getPSDocs.toDate_value',
document.getPSDocs.toDate_value.value)">
<img src="calendar.gif" width="25" height="25" border="0"
alt="Click here to Date Stamp"></a>
</td>
</tr>
<tr>
<td colspan="2"> 
</td>
</tr>
<tr>
<td colspan="2" align="center">
<img height="3" src="../images/rule_navyH4W760Solid.gif"
width="759" border="0">
</td>
</tr>
<tr>
<td colspan="2"> 
</td>
</tr>
<tr>
<td align="center" colspan="2">
<font size="3" face="Arial, Helvetica, sans-serif"
color="003366">
<b>Pick Request
Number: </b></font>
<select name="search_type">
<option value="Contains">Contains</option>
<option value="Begins With">Begins With</option>
<option value="Ends With">Ends With</option>
<option value="Is">Is</option>
<option value="Is Not">Is Not</option>
<option value="Before">Before</option>
<option value="After">After</option>
</select>
<input type="text" name="prNumber" required="yes"
message="Request Number Must Be Entered for Search">
</td>
</tr>
<tr>
In my action page, I build the query based on the search
criteria. Here is what I have so far :
<cfquery name="getPRNum" datasource="docuTrack">
SELECT *
FROM dbo.psFileInventory
<cfif form.search_type is "Contains" and form.prNumber is
not "">
Where dbo.psFileInventory.prNumber like '%#form.prNumber#%'
<cfelseif form.search_type is "Begins With" and
form.prNumber is not "">
Where dbo.psFileInventory.prNumber like '#form.prNumber#%'
<cfelseif form.search_type is "Ends With" and
form.prNumber is not "">
Where dbo.psFileInventory.prNumber like '%#form.prNumber#'
<cfelseif form.search_type is "Is" and form.prNumber is
not "">
Where dbo.psFileInventory.prNumber = '#form.prNumber#'
<cfelseif form.search_type is "Is Not" and form.prNumber
is not "">
Where dbo.psFileInventory.prNumber <>
'#form.prNumber#'
<cfelseif form.search_type is "Before" and form.prNumber
is not "">
Where dbo.psFileInventory.prNumber <= '#form.prNumber#'
<cfelseif form.search_type is "After" and form.prNumber
is not "">
Where dbo.psFileInventory.prNumber >= '#form.prNumber#'
</cfif>
<cfif form.fromDate_value is not " " and form.prNumber is
not " ">
And fileDate between #CreateODBCDate(form.fromDate_value)#
and #CreateODBCDate(form.toDate_value)#
<cfelseif form.fromDate_value is not " " and
form.prNumber is " ">
Where fileDate between #CreateODBCDate(form.fromDate_value)#
and #CreateODBCDate(form.toDate_value)#
</cfif>
order by prNumber
</cfquery>
I basically see to see what was select so that I can use the
like, not like, etc..Then I check to see if there is a date value
so that I can know whether to use AND in the select statement.
If both the field and dates are selected, then it would be
select where xxxx and date.......
If the field is selected only, then it would be select where
xxxx
If the date is selected only, then it would be select where
date xxxxxx
The problem is when I check for date is " " in the cfif
statement, keep getting error about null values. So I check for
date is null or date is not null, but that still does not work. It
works find when I check for both the field and date as not " ",
then I can use AND, but when I try to check for any other
combinataion, I get the NULL error.
How can I fix this ?

trojnfn wrote:
> Thanks for the reply.
>
> Does this function work like isDefined ?
>
> To check for the existence of a date so that I can build
my query, I would
> have :
> <cfif isDate(start_date) and field is not " ">
> And date between .xxxxxx
> <cfelse>
> <cfif isDate(start_date) and field is " ">
> where date between xxxxx
> </cfquery>
>
> Is this how it works ?
>
now that's a bit of convoluted logic there...
how about:
<cfif isdate(yourdate)>
<cfif yourfield is " ">
<cfelse>
</cfif>
</cfif>
you can add a <cfelse> in the outer cfif if you need to
have a separate
condition for yourdate NTO being a date
another thing i noticed: what's up with " "? i mean, why a
space between
the quotes? you know that a blank form field does NOT have a
space as
value, right? so if you are checking that a user has entered
something
in a field or not, and you are using <cfif somefiled is "
">, if a user
did not fill in that field your cfif will return FALSE; if
you used
<cfif somefield is ""> it would have returned TRUE.
i suggest instead of checking for a blank value of a filed,
check the
length of that value instead: <cfif len(trim(somefield))
is 0>
hth
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Similar Messages

  • In  BDC how you handled header data and item data

    In  BDC how you handled header data and item data

    Raja,
    Can you be more clear ?
    Usually you load the header data one and then loop at the item data and then load the item data.
    This example should help you.
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    Regards,
    Ravi
    Note - Please mark all the helpful answers

  • How to handle time&date

    can anyone tell me how to handle time&date correctly?using Calendar,GregorianCalendar,TimeZone,Locale
    thank you very much

    This is too large a topic to discuss in depth here. Here is a link to a tutorial on times and dates, and a search link that references many documents on the subject.
    http://java.sun.com/docs/books/tutorial/i18n/format/dateintro.html
    http://onesearch.sun.com/search/developers/index.jsp?and=calendar+&nh=100&phr=how+to&qt=&not=&field=&since=&col=javatecharticles&col=javatutorials&col=devall&rf=0&Search.x=20&Search.y=7
    When you have specific questions, just ask.

  • How to remove blank data from a byte array

    Hi All,
    How to remove blank data from a byte array. Suppose I created a byte array as byte[] b = new byte[8192] and i read the data as inputstream.read(b). If the data that has been received is only 1000 bytes length, how to find out how much data has been read or how to delete that blank 7192 bytes of data?
    Thanking you,
    Regards,
    Shankar.

    1) Always try to sidestep this by allocating only the necessary amount of space required...
    2) If 1 is not possible, you will have to index byte for byte how much data was read into the array which
    denotes reading byte for byte... not ideal as this is relatively slow...
    Are you reading from a file?

  • How to handle empty Dats field received from SAP RFC response

    Hi All,
    I am invoking a SAP RFC which gives me a Dats field in response.
    A valid dats fields is successfully received by my pipelines.
    But when an empty Dats field is received, My pipeline fails and i get error.
    How to handle the empty Dats field from SAP

    Hi Anant,
    This is because the legacy SAP adapter accepted RFC messages with date field empty. In the new version, the same call results in an error. WCF-SAP adapter doesn't allow blank XML nodes.
    You need to use the below custom pipeline component as a workaround.
    Refer:
    Pipeline component for enabling legacy behavior in WCF-SAP adapter.
    Rachit
    Please mark as answer or vote as helpful if my reply does

  • How to get blank data in alv?

    hi
    im finding the difference between 2-dates...
    below is my code......
    my problm is wn there is no data in the gstri field then v_dat1 should be blank...but im getting zeros...
    how to get blank instead of zero?
    IF <fs_final>-gstrp is not INITIAL and
      ( <fs_final>-gstri is not INITIAL ) .
    CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'
          EXPORTING
            date1            = <fs_final>-gstrp
            date2            = <fs_final>-gstri
          IMPORTING
            datediff         = v_dat1
          EXCEPTIONS
            invalid_datetime = 1
            OTHERS           = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    ENDIF.
        IF ( <fs_final>-gstrp GT <fs_final>-gstri ) AND
           ( NOT <fs_final>-gstri IS INITIAL ) .
          v_dat1 = -1 * v_dat1.
        ENDIF.
    Regards
    Smitha

    Hi,
    If you are using FM 'REUSE_ALV_GRID_DISPLAY' then In your fieldcatalog there is one component called 'no_zero' make it to 'X' like :
          WA_FLDCAT-TABNAME = 'IT_FINAL'.
          WA_FLDCAT-COL_POS = 1.
          WA_FLDCAT-SELTEXT_L = 'BOQ.Amt'.
          WA_FLDCAT-FIELDNAME = 'ZAMT'.
          WA_FLDCAT-NO_ZERO = 'X'.
          WA_FLDCAT-DATATYPE = 'CURR'.
          WA_FLDCAT-INTLEN = '20'.
          APPEND WA_FLDCAT TO IT_FLDCAT.
          CLEAR : WA_FLDCAT.
    That's it,it will not display if the field value is zero.
    Hope this helps,
    Thanks & Regards,
    Rock.

  • In BAPI PO CREATION How to handled errors datas

    Hi friends ,
    In BAPI PO CREATION upload the datas How to handle/capture errors datas.?
    arun

    Hi,
    After completion of the program IT_RETURN table will have all the messages in it.
    Loop the IT_RETURN internal table and display the data.
    Regards
    Sudheer

  • How to handle the Date & Time Object?

    Hi,
    I have big problem.I am working on j2ee application(using jsp & servlets).I am using Jboss App Server. The server is placed in India.
    But there is two offices, one is in India ,another one is in USA.
    But i want to handle the date and timestamp object commonly,
    But this object should be able to calculate their own date & timestamp object( e.g.,India,USA ).How can i solve this issue?.
    Help appreciated!
    P.Saravanan

    Hi,
    I have big problem.I am working on j2ee application(using jsp & servlets).I am using Jboss App Server. The server is placed in India.
    But there is two offices, one is in India ,another one is in USA.
    But i want to handle the date and timestamp object commonly,
    But this object should be able to calculate their own date & timestamp object( e.g.,India,USA ).How can i solve this issue?.
    Help appreciated!
    P.Saravanan

  • How to handle blank line in File adapter

    Hi,
    I am using a file adapter with CSV as input file. If I have a blank line in CSV file, BPEL is failing read it, no instance is created and file is archieved.
    Please let me know how to handle this issue.
    Thanks

    Hi Yatan,
    I am already using rejectedMessageHandlers, I am on 10.1.3.3.
    Here's my bpel.xml
    ============
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <BPELSuitcase>
    <BPELProcess id="EmpAddressUpdABCSImpl" src="EmpAddressUpdABCSImpl.bpel">
    <partnerLinkBindings>
    <partnerLinkBinding name="ReadFile">
    <property name="wsdlLocation">ReadFile.wsdl</property>
    <property name="rejectedMessageHandlers">file://E:/HRARCHIVE/BadData</property>
    </partnerLinkBinding>
    <partnerLinkBinding name="InsertAddressUpd">
    <property name="wsdlLocation">InsertAddressUpd.wsdl</property>
    <property name="retryInterval">60</property>
    </partnerLinkBinding>
    </partnerLinkBindings>
    <configurations>
    <property name="sensorLocation">sensor.xml</property>
    <property name="sensorActionLocation">sensorAction.xml</property>
    </configurations>
    <activationAgents>
    <activationAgent className="oracle.tip.adapter.fw.agent.jca.JCAActivationAgent" partnerLink="ReadFile">
    <property name="portType">Read_ptt</property>
    <property name="rejectedMessageHandlers">file://E:/HRARCHIVE/BadData</property>
    </activationAgent>
    </activationAgents>
    </BPELProcess>
    </BPELSuitcase>
    Someone told me that this can be achieved by changing the native schema, I tried many options but no result. Please suggest me.
    -- Shirish

  • How to Handle Blank Field Value based Condition in SmartForms

    Dear Sir,
    In SMARTFORM , we need to define a Condition that incase Field Value is not equal to  BLANK value (blank means that field is empty) then a specific text gets printed .
    Our problem is that  We do not know as how to define  Empty Field Value  based condition .
    Had it been Non Empty Field value based condition then solution was simple and could be done in following way :
    Field Value                        R                     Comparision Value
    WA_KZDKZ                      =                      'X'
    In our case , we need to give Blank (Empty Value) instead of 'X' .
    Kindly help us pl .
    Rgds
    B Mittal

    Hi,
    To handle blank field values in SMARTFORMS,
    Go to the conditions tab in your SMARTFORM and give condition there
    Field                Comparision operator          value
    <Field name>      <> Here symbol is diff     space.
    eg:
    wa_mara-matnr    =/                                   space.
    Regards,
    Santosh Kumar M.

  • How to handle The Date error???

    Actually I am using three dropdown list as day,month and year
    day contains 31 items and same values i.e., 1,2,3...31
    and month contains jan,feb,....dec
    year 1981,1982,.....2007
    and I am concateded these three to form date as
    d:=:day||'-'||:month||'-'||:year;
    Now my problem is
    when i am selecting values 31 jun 1980,30 feb 1980 i.e., non existing dates then it is throwing
    "Unhandled trigger ..... "
    please tell me how to handle it?

    There are a number of different exceptions you can get with dates.
    SELECT To_Date('10132007','DDMMYYYY') FROM dual;
    ORA-01843: not a valid month
    SELECT To_Date('99122007','DDMMYYYY') FROM dual;
    ORA-01847: day of month must be between 1 and last day of month
    SELECT To_Date('10-FEB-2007','DDMMYYYY') FROM dual;
    ORA-01858: a non-numeric character was found where a numeric was expectedFor this I would just trap the ORA-01847 and 'when others' exceptions.

  • How to handle the date attribute,passing parameter from one page to another

    hi Friends,
    i want to pass data attribute from one page to another page-
    i am passing like below ,in jdev log window i am getting below error.
    String StatusUpdateDate = row.getAttribute("StatusUpdateDate");
    params.put("StatusUpdateDate",StatusUpdateDate)
    Error(121,50): incompatible types; found: java.lang.Object, required: java.lang.String
    Suppose i am passing like below , while moving one page to another i am getting below error in application
    String StatusUpdateDate = row.getAttribute("StatusUpdateDate").toString()
    Status Update Date - JBO-25009: Cannot create an object of type:oracle.jbo.domain.Date with value:26-MAR-2009
    please can any suggest me how to handle this error.
    Thanks and Regards,
    vamshi

    Hi Pratap, Thanks for your help
    it was my mistake that previously property it was varchar2, now i have changed as you suggested every thing. still i am getting error. this is my code-
    AM CODE-
    public void xxselection(String Name, String Email,String Product,String Region, DATE StatusUpdateDate)
    DetailVOImpl vo1=getDetailVO1();
    vo1.initQuery2(Name);
    Row detailRow = vo1.createRow();
    detailRow.setAttribute("Name", Name);
    detailRow.setAttribute("Email", Email);
    detailRow.setAttribute("Product", Product);
    detailRow.setAttribute("Region", Region);
    detailRow.setAttribute("StatusUpdateDate", StatusUpdateDate);
    vo1.last();
    vo1.next();
    vo1.insertRow(detailRow);
    detailRow.setNewRowState(Row.STATUS_INITIALIZED);
    Controller- Process Form Request- Source page
    if (pageContext.getParameter("Detail")!= null)
    String Name=row.getAttribute("Name").toString();
    String Email=row.getAttribute("Email").toString();
    String Product=row.getAttribute("Product").toString();
    String Region=row.getAttribute("Region").toString();
    DATE StatusUpdateDate =(DATE)row.getAttribute("StatusUpdateDate");
    HashMap params =new HashMap();
    params.put(" Name", Name);
    params.put("Email",Email);
    params.put("Product",Product);
    params.put("Region",Region);
    pageContext.putTransactionTransientValue("StatusUpdateDate",StatusUpdateDate); //As you suggested
    pageContext.forwardImmediately("OA.jsp?page=/xxm/oracle/apps/pos/stg/webui/DetailStagePG",
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,
    params,
    true, // retain AM
    OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
    another page Controller-Process request-Destination page-
    String Name = pageContext.getParameter("Name");
    String Email = pageContext.getParameter(" Email");
    String Product = pageContext.getParameter("Product");
    String Region = pageContext.getParameter("Region");
    DATE StatusUpdateDate=(DATE)pageContext.getTransactionTransientValue("StatusUpdateDate");
    Timestamp tstmpStatusDate=StatusUpdateDate.timestampValue();
    System.out.println("tstmpStatusDate"+tstmpStatusDate);
    Serializable[] parameters1 = {Name,Email,Product,Region,tstmpStatusDate};
    am.invokeMethod("xxselection", parameters1);
    Error - getting at while running the application page to page
    No method with signature - No method with signature - xxselection(class java.lang.String, class java.lang.String, class java.lang.String, class java.lang.String, class java.lang.String)
    every thing is getting passed except DATE Attribute, please check the code and update me
    Thanks in Advace-
    vamshi

  • How to get blank data wn one date is initial?

    hi
    im finding the difference between 2-dates...
    below is my code......
    my problm is wn there is no data in the gstri field then v_dat1 should be blank...but im getting zeros...
    how to get blank instead of zero?
    IF <fs_final>-gstrp is not INITIAL and
    ( <fs_final>-gstri is not INITIAL ) .
    CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'
    EXPORTING
    date1 = <fs_final>-gstrp
    date2 = <fs_final>-gstri
    IMPORTING
    datediff = v_dat1
    EXCEPTIONS
    invalid_datetime = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDIF.
    IF ( <fs_final>-gstrp GT <fs_final>-gstri ) AND
    ( NOT <fs_final>-gstri IS INITIAL ) .
    v_dat1 = -1 * v_dat1.
    ENDIF.
    Regards
    Smitha

    HI,
    The type defination of date difference is P whose default value is 0. for that reason you are getting 0 in v_dat1. and thats why it can't be blank.
    if you using the v_dat1 for futher processing than you can first check whether v_dat1 is 0 or not then you can proceed with your logic...
    OR
    other think you have to delcare another variable of type char, assign your v_dat1 and then SHIFT <char var> LEFT DELETING LEADING '0'.
    Hope it helps

  • How to handle blank root element in xml source file

    Hi There,
    I have a dataflow which using xml source file. The job keep failing and I guess it might be caused by one of the root element which is blank. Can anyone advise me how to handle it?
    The xml file look like this:
    -<orderinfo>
    --<orderdetail>
    ---<orderid>1</orderid>
    ---<orderdate>20110101</orderdate>
    --</orderdetail>
    --<abc />
    -</orderinfo>
    element <abc> is blank
    Thanks and Regards,
    BL

    Hi Suneer,
    The issue is DS cannot validate the source file at all. It returns error message when I try to preview the source file in the dataflow. Is there any work around I can implement other than request the source team to change the file layout?
    Thanks,
    BL

  • How to handle transactional data?

    Hello,
    I try to do a customer analyse with ODM, for that
    I collect from some different tables many of attributes,
    some of them are transactional.
    How I understand the ODM manual, I have to select for
    the analyse that the data are in the transactional
    format, but what I could do if there are not only 3
    different columns, which define the transaction? Whit
    other words I have more than one attribute which is
    transactional.
    Is the right Selection of the data format important for
    the results, or could I use the single data format, if I
    could not to do that, which alternative I have?
    M. Neudeck

    Hi,
    What version of ODM are you using.
    If you are using ODM 10.1, you have the option of either using the java api or the pl/sql api. Each api has a different approach for handling txn data.
    The java api will accept only a single txn format table (case id, name, value). This table can contain a mixture of data that are not of the same metric. You could have quanities, counts, categoricals etc.
    The plsql api has a custom object type for nested numericals or nested categoricals that you use to create a nested table as a column. You can create multiple columns as nested tables in your input table for model build.
    As to data format, that issue is also api dependent. In java,you can specify the mining type in the mining function setting. In pl/sql, the mining type is based on the data type, so data type is very important.
    Thanks, Mark

Maybe you are looking for

  • Help! Battlefield 2 doesn't work on iMac 24"

    Hi! I have iMac 24" with nVidia GeForce 7300 GT, BootCamp'ed Win XP. So, when I try to start Battlefield 2 it crashes straight after the black screen. I suppose just before game's intro. I've seen there in discussions that BF2 works on iMacs with ATI

  • How to read open customer items from Archive system i.e BSID & BSAD tables

    Hi, We have a requirement to get the customer line items data that were open as of key date from archive system and present it as customer aging through a custon report. Example,in SAP R/3 we have data for last 3 yrs and beyod that the data is in arc

  • Dumb Question: Count of Rows Returned?

    I am using a dbcontrol to get rows from the database. I am using the netui-repeater to display the results. The repeater datasource is "request.results". My question is how do I get the total number of records returned from the query? I know this is

  • Whats the default DPI of PDF when created from OBIEE

    As per topic, when we download to PDF from Answers or dashboards, does anybody know the DPI that is used ? You'd normally specify it on creation of the pdf. Cheers Alastair

  • Can Photoshop Elements 12 work with Photoshop Premiere 13?

    I already have Photoshop Elements 12 and was bought Premiere 13 for xmas and they are not recognising each other. Each keep asking if I want to download the trial version of each? I dont know if you can use Photoshop Elements 12 with Photoshop Premie