Creating process for multiple Date fields for update or insert in APEX

hello there,
could someone please help me?
i have a form on Apex based on view that is based on three tables and updating and inserting ok using trigger instead of.
i have a problem now as in my form i have around 75 fileds (items) incuding 30 or more date fields which could be populated or left blank or update later.
so for each date field i have two boxs; one for date, input as dd/mm/yyyy (text field) and second for time, input as 23:45. All dates will be insert or update manually by user. so as i mentioned not all date fields could be poulated at one stage.
so i have created some process and validations and all of them work fine but i came accross if date left blank then (:) giving me problem so i have done following further process for each date field. In real table all the date fields have data type date.
declare
v_my_var date; -- for first date field
str_dy VARCHAR2(10);
dt_indx date;
str_tm VARCHAR2(20);
tm_indx date;
begin
str_dy := :p4_first_date
str_tm := str_dy||' '||substr(:p8_first_date_hh,1,2)||':'||substr(:p8_first_date_HH,4,2);
dt_indx := to_date(str_tm,'DD/MM/YYYY HH24:MI');
IF str_dy is not null then
v_my_var :=dt_indx;
ELSE
v_my_var := NULL;
END IF;
update table 1 set my_date = v_my_var where d_id= :p4_d_id;
end;
above code work fine but one date field of course therefore i have to do same code for each date field with changes and initialise variable again and again for each field.
so i like to ask is there any easy way that is more professional. i was thinking about the procedure and using collection or similar but honestly not much experience on that so could some one please help me?
I will be very thankful.
KRgds

Hi,
You can do the needful by re-using the code if you can give the item names as P8_DATE1, P8_DATE_hh1, P8_DATE2, P8_DATEhh2 etc..So your item name just differs by a sequence.
Now you write function which will return desired date value taking above items as input. Pass item names to this function, get session state using APEX_UTIL.GET_SESSION_STATE('item_name') API.
Now modify you code as
FOR i IN 1..30
LOOP
v_date_array[i] = f_get_date('P8_DATE'||i, 'P8_DATEhh'||i);
END LOOP;
....Now you have all date valus in array. Just write one update as follows
UPDATE  TABLE1
SET date1 = my_date_array[1], date2 = my_date_array[2]..
WHERE ....Hope it helps :)
Cheers,
Hari

Similar Messages

  • Javascript for multiple date fields

    Hi all-
    I have to write javascript for 15 different date fields in a form.
    The requirement here is that we convert all date fields on Page 100 from date pickers (editable date fields) to display-only date fields with two controls for the users to set the date.
    If the field is empty (no date registered yet), there will be a green checkmark(X). When the user clicks this checkmark, the current date is entered into the field.
    If the field is not empty (there is a date already in the system), there will be a red X. When the user click this red X, the date from the date field is removed.
    The javascript I am using here is
    </script>
    <script type="text/javascript">
         function init(){
              var datePickerVal = $v2('P100_TODAYS_DATE');
              if(datePickerVal){
                   $x_Show('ToggleDateR');
                   $x_Hide('ToggleDateG');
              }else{
                   $x_Hide('ToggleDateR');
                   $x_Show('ToggleDateG');
         function toggleDateFunc(pValue){
              var sysDate = $v2('P100_DATE');
              if(pValue == 'R'){
                   $x_Hide('ToggleDateR');
                   $x_Show('ToggleDateG');
                   $x_Value('P100_TODAYS_DATE','');
              }else if(pValue == 'G'){
                   $x_Show('ToggleDateR');
                   $x_Hide('ToggleDateG');
                   $x_Value('P100_TODAYS_DATE',sysDate);
         window.onload = init;
    </script>
    This javascript is working for one date field( 'P100_TODAYS_DATE') but i have 15 different date fields in this page(100) all should have same funtionality. Please help me out how to write a logic to use this function for all the date fields.
    Thanks,(apex 3.2)
    Greenhorn
    Edited by: Greenhorn on Jul 19, 2011 12:30 PM

    Hi,
    You can do the needful by re-using the code if you can give the item names as P8_DATE1, P8_DATE_hh1, P8_DATE2, P8_DATEhh2 etc..So your item name just differs by a sequence.
    Now you write function which will return desired date value taking above items as input. Pass item names to this function, get session state using APEX_UTIL.GET_SESSION_STATE('item_name') API.
    Now modify you code as
    FOR i IN 1..30
    LOOP
    v_date_array[i] = f_get_date('P8_DATE'||i, 'P8_DATEhh'||i);
    END LOOP;
    ....Now you have all date valus in array. Just write one update as follows
    UPDATE  TABLE1
    SET date1 = my_date_array[1], date2 = my_date_array[2]..
    WHERE ....Hope it helps :)
    Cheers,
    Hari

  • PROBLEM  TRANSFERRING   MULTIPLE   DATA  ENTRIES    FOR  ONE KEY-FIELD.

    DEAR   EXPERTS ,
       I  HAVE  TRANSFERRED  DATA  FROM  THE  FINAL  INTERNAL  TABLE  OF  MY  ABAP REPORT (NOT ALV)  TO  CUSTOM  Z-TABLE  CREATED  IN  SE11.
    BUT  MY  PROBLEM  IS  :  I   COULD  NOT   TRANSFER  MULTIPLE   DATA  ENTRIES   FOR  A  PARTICULAR  FIELD.
    FOR  EXAMPLE :  IN  TABLE  EKKO  THERE  ARE   FOUR  EBELN-4900006375  AND  FOR  THAT  DIFFERENT  EBELP S  ARE
    PRESENT.  I  COULD  TRANSFER  ONLY  THE  FIRST  ENTRY ,  THAT  IS :  EBELN -  4900006375  AND   EBELP - 0010,
    AFTER  THAT  THE  ZTABLE  IS  NOT  GETTING  UPDATED  TO  EBELN-4900006375 FOR  EBELP - 0020  AND  SO ON.
    I  HAVE  TRIED  ALL  THE  '  MODIFY, INSERT,  UPDATE  '  STATEMENTS.  I  HAVE  USED  AT - USERCOMMAND - HIDE  AND  CHECKBOXES.
       PLEASE   SUGGEST   A   SAMPLE   CODE   FOR   THIS.
    Moderator message: please post again, but not in all upper case.
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    Edited by: Thomas Zloch on Jun 19, 2011 10:05 PM

    There are actually 5 queries in this report now. From what I understand about a union query, I don't think it will work here because the data being returned in each of the queries is so different. I basically need to know how to make all the criteria for each individual to be displayed before proceeding to the next data set, which will include the same data as the first, but for the next employee, and so on. I need to basically create a repeating frame with each individual's respective data I guess, but every time I do, it tells me that it's referencing an invalid group.

  • Delimiter for multiple display fields

    Hi ,
    Is there any way in MDM so we can change the delimiter for multiple display fields.
    Suppose for a lookup table code and description both are display fields.In Data manager when we select main table as our current table ,value in that lookup field will appear as code,description ,but as per the requirement it should be hyphen separated i.e code- description.
    Is there any way we can change the delimiter.
    Thanks in Advance
    Regards,
    Neethu Joy

    Hi Neethu,
    No, there is no way to change the delimiter but I can suggest you some workaround.
    Create one more field in same lookup table and mark it as display field. Create one assignment with the expression code&"-"&Description and put it in workflow having trigger action = Record Create and Record Update with Automatic launch action. With this, whenever you modify lookup data i.e. either code or description workflow will automatically update the third filed.
    Just check if this fits in your requirement.
    Regards,
    Jitesh Talreja

  • Error when saving a default format for a date field in 11g

    Getting this error when attempting to save the default for a date field in 11g:
    The current xml is invalid with the following errors: Bad xml instance! <?xml version="1.0"?> <sawsavedformat:metadata xmlns:sawsavedformat="com.siebel.analytics.web/savedformat/v1.1"><sawsavedformat:columnSavedFormats><sawsavedformat:columnSavedFormat xmlns:saw="com.siebel.analytics.web/report/v1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="sawsavedformat:regularColumnSavedFormat" columnName="&quot;Retrospectives&quot;.&quot;Time Dim&quot;.&quot;Two Months Ago&quot;"><saw:displayFormat><saw:formatSpec suppress="suppress" wrapText="true" visibility="visible" hAlign="left" vAlign="top"><saw:dataFormat xsi:type="saw:custom" customFormat="MMMM dd, yyyy" displayTimeZone=""/></saw:formatSpec></saw:displayFormat><saw:tableHeading><saw:displayFormat><saw:formatSpec/></saw:displayFormat></saw:tableHeading><saw:columnHeading><saw:displayFormat><saw:formatSpec/></saw:displayFormat></saw:columnHeading></sawsavedformat:columnSavedFormat></sawsavedformat:columnSavedFormats></sawsavedformat:metadata>
    Line:2, Col:608, Attribute 'displayTimeZone' is not declared for element 'dataFormat'
    Thoughts and suggestions?

    I have a Support Request open with Oracle right now (it's taking a few weeks to resolve) but here's the update:
    OBIEE 10g handles DATE types differently than 11g. Both the support rep and I can't figure out how, but they are different. If you bring the column in as a DATETIME in your Physical Layer you can't save it system-wide, even if you do set a time zone for your account (My Account -> Preferences -> Time Zone). If you bring the column in as DATE you can save it system-wide but you can't display the hours/mins/secs, only the M/D/Y. This has been tested on a 9i and 10g database and produced the same thing on both. The problem never occurred with those same columns using OBIEE 10g.
    Oracle support has not fully admitted this as a bug, but the rep working on this SR said this will probably be fixed in the next release- 11.1.1.4, which is due out late Jan/early Feb of this year. He is trying to reproduce this so he can log it as a bug (which we all are hoping for!) so Oracle can address it.
    For now, I've found that you are stuck with two options: 1) bring the column in as a DATE, display it system-wide as a saved format, but you can't show the time, and 2) don't save that date value with a system-wide formatting and set it manually on every report you need a custom format (don't forget to set your time zone).
    If I hear anything more back from Oracle support I'll update this thread.
    Sorry guys, looks like we're all stranded on this one...

  • Date fields for info structure S032 are not generated

    Hi Experts,
    I am trying to update set up tables for '02'  using OLI2BW. I excluded some plants from selection and executed the set up. But the job run for few mins and completed with the message "Date fields for info structure S032 are not generated".
    I couldn't see any records in RSA3.
    Please through some light on this issue.
    Points reward for usefull help.
    Please no wild guess.
    Regards,
    -N-

    Did you find out why. I am getting same message.
    Thanks
    Shalini

  • Equivalent Data Field for 0EXRATEXACC Info Object

    Hi Gurus,
    I have created a DSO using 2lis_13_VDITM data source by installing the same Info Source. Here i am not able to find the Equivalent Data Field for 0EXRATEXACC Info Object which is in Transfer Rules.
    So, Please let me know the Equivalent Data Field for 0EXRATEXACC Info Object.
    Points are assigned defenetely.
    Thanks in advance
    Peter B

    Hi,
    U have a field KURRF in table KURRF
    *Assign points if helpful.

  • After upgrade from 4.6c to ECC6.0 F4 Help is not coming for few date fields

    Hi Friends
    Just now we have completed upgrade project from 4.6c to ECC6.0.
    After upgrade F4 help is not working for some date fields.
    For example its working in MB11,Its not working in va01,vf01 like that.
    In abap side we checked ...not able to find any issues in coding level, because its a standard SAP code.
    So if any solution is there to correct this issue.Kindly help me to resolve this asap.
    Thanks
    Gowrishankar
    Edited by: gowrishankar p on Nov 17, 2009 7:25 AM

    Hi
        Please refer to the SAP note 1278056 and 1278115 - PDS Display: F4-characteristic values are not selectable.  Hope this will resolve your issue.
    Regards,
    JB

  • How system will automatically populate clearing date field for invoices paid similar to when payments are made to the vendors

    Hi SAP Gurus,
    Could you help me on this, How system will automatically populate clearing date field for invoices paid similar to when payments are made to the vendors.
    Regards
    Mohan

    Hi Ramakrishnappa,
    If you clear the invoice against payment, then the invoice clearing date would be payment document posting date.
    Regards,
    Mukthar

  • Error handling for master data with direct update

    Hi guys,
    For master data with flexible update, error handling can be defined in InfoPackege, and if the load is performed via PSA there are several options - clear so far. But what about direct update...
    But my specific question is: If an erroneous record (e.g invalid characters) occur in a master data load using direct update, this will set the request to red. But what does this mean in terms of what happens to the other records of the request (which are correct) are they written to the master data tables, so that they can be present once the masterdata is activated, or are nothing written to masterdata tables if a single record is erroneous???
    Many thanks,
    / Christian

    Hi Christian -
    Difference between flexible upload & Direct upload is that direct upload does not have Update Rules, direct upload will have PSA as usual & you can do testing in PSA.
    second part when you load master data - if error occurs all the records for that request no will be status error so activation will not have any impact on it i.e. no new records from failed load will be available.
    hope it helps
    regards
    Vikash

  • Marriage anniversary date field for customer contact

    Hi
    We like to have Marriage anniversary date field for customer contact.
    We found Birthday field & even Marital Status in Customer Contact. However, Marriage Anniversary Date is missing.
    Please suggest whether it is already avalible somewhere? If yes, how to get it (in XD01/XD02), or what is the alternative then.
    Thanks.
    - Sunil

    Hi,
       I don't think SAP has provided marriage anniversary field , you can very well user REMARKS field to enter the details.
    Regards,
    Siraj

  • F4 help for PO date field in VA01 transaction during upgrade

    Hi All,
    We are working on upgrade project 4.6c to ECC 6.
    We came across one scenario.
    F4 help for PO date field is not coming in newer version in VA01 transaction but i checked in older version it is coming F4 help for PO date(calender).
    May i know the reason regarding this.
    Any clues
    Regards
    Jai
    Edited by: Jayanth16 on Nov 12, 2009 6:14 PM
    Edited by: Jayanth16 on Nov 12, 2009 6:22 PM

    Hi,
    User did some changes in include LSDSDF05 due to that F4 help is not coming.
    So i correct that one.
    Regards
    Jai

  • Display Title in BEX query for Master Data Field

    Hi All,
    Appreciate if someone can assist me in this.
    When we display query result, we will have results of master data field for as master data and Text, e.g Customer and customer text.
    BEX display:
    Header Line : Customer
    Display Line : 90002011   Mary Kay
                          90002023   John Smith
    For the header Line, we have title 'customer', can we have the title for 'Customer Description' instead of having it as a blank field.
    Appreciate if someone can assist me in this, I cant find this issue posted by anyone.
    Thank you.

    Hi,
    For one object you can not have seperate description for key and text.
    Either you need to have seperate object. Check if your Customer object is having some name attribute then display cutomer key with name attribute so that there will be two object and you may change the description in report display.
    If this is not possible then you may not have dirctly in reporting. You need to stage one more object in staging area with same cutomer field then one you may use as text the other one as key.
    I hope it will help.
    Thanks,
    S

  • Multiple Date Fields (Fact Table) - Linking with Time Dimension

    I have a fact table that has multiple date columns.
    I can make a time dimension, but it has to be joined to a particular date column. This becomes difficult because of the limit in having multiple date fields reference one time dimension. I can see possibly
    creating a date table which contains all dates, link to fact as well as time dimension table. I am trying to better visualize the table layout on this one. Or are there possibily better ways of looking at this senerio
    Any idea's

    Figured this one out; going to use one time dimension - what looking too much into the details in regard to this scenerio

  • GoldenGate for Big Data 12c for Win x64?

    I was looking for the GoldenGate for Big Data download for Win x64 and all I found on edelivery was Linux, Solaris, HP-UX and AIX platforms, but no Windows at all (see the screenshot below). I wonder if it's been released yet? Or, is it just an unfortunate omission?
    Thanks
    Andy

    Thanks, for your reply, Karan!
    I tried following your advice, but bumped into yet another similar problem. I've installed OGG 12c and now I can't seem to be able to find the matching version of the GG Application Adapters for JMS and Flat File for the Win x64 platform. The latest version of Application Adapter available on edelivery is 11.1.1.0.0 which means I need to downgrade OGG to the same version. No big deal but I wanted to make sure I'm not missing anything.
    I wonder if anybody has any idea as to whether Application Adapters 12c for JMS and Flat File is available for the Win x64 platform, and if so, where can I download it from?
    Thanks
    Andy

Maybe you are looking for

  • Export data to flat file with no delimiter

    Hi I've 3 columns in a view that i want to export to a flat file. I don't want the flat file to contain any delimiter such as commas , tabs etc.. I am using fixed width with the following setting Header row delimiter {CR}-{LF} Advance Options :  Inpu

  • Emoji made in iOS don't work in Lion

    Has anyone noticed that iOS doesn't make Emoji compatible with Lion? Hopefully this will be fixed in iOS 5. Is it fixed in iOS 5? It doesn't matter what program I type Emoji in; Safari, Mail, Plaintext, Instagram. They never show up in Lion properly.

  • Firefox minimizes itself and crashes - Windows 7

    My Firefox 3.6.12 in my notebook when is minimized, for a little while, crashes itself and I can't maximize it. The program is shown on the Win7 taskbar. On the Windows task manager, FF appears like "working", but, if I press alt+tab or windows+tab,

  • Can I develop plug-in using cocoa as UI instead of ADM?

    I'm just about to start developing illustrator on mac. Is it possible to use cocoa framework to design the UI instead of ADM? Then my plug-in code will be mixed with C++ code and objective C++ code. I don't see this from the sample code, can anyone t

  • Galer's "Maximum Performance"

         Shortly after purchasing Elements 8 I also bought "Maximum Performance" by Mark Galer.  For the most part it has been a great help to me although I have never discovered how to down load and use the presets he includes.  I recently went to use t