Use Formule on FORM with REPORT - result stored at table

Hi all,
What is the best solution for?
I have region with FORM WITH REPORT on the same PAGE.
Values stored at table INFO with column ID, MYDATE, TIME_START_HOUR, TIME_START_MIN, TIME_END_HOUR, TIME_END_MIN, SUM1, SUM2
ITEMS on the form:
P1_ID (hidden)
P1_MYDATE (date picker)
P1_TIME_START_HOUR (select list)
P1_TIME_START_MIN (select list)
P1_TIME_END_HOUR (select list)
P1_TIME_END_MIN (select list)
P1_SUM1 (hidden)
P1_SUM2 (hidden)
After user fill in MYDATE, TIME_START_HOUR, TIME_START_MIN, TIME_END_HOUR, TIME_END_MIN then I need proces for calculation SUM1 en SUM2. Result stored (one record) at table INFO.
Report shows all columns. User had possibility to update the record
Formule:
Select
(CASE
when to_char(mydate,'DY','nls_date_language=dutch') in ('ZA','ZO')
THEN substr(to_timestamp (mydate||':'||TIME_END_HOUR||':'||TIME_END_MIN ||':00','DD-MM-YY:HH24:MI:SS') -
to_timestamp (mydate||':'||TIME_START_HOUR||':'||TIME_START_MIN ||':00','DD-MM-YY:HH24:MI:SS') -
(interval '00 00:00:00' day to second)
,12,5)
ELSE '08:00'
END) SUM1,
(CASE
when to_char(mydate,'DY','nls_date_language=dutch') in ('ZA','ZO')
THEN substr(to_timestamp (mydate||':'||TIME_END_HOUR||':'||TIME_END_MIN ||':00','DD-MM-YY:HH24:MI:SS') -
to_timestamp (mydate||':'||TIME_START_HOUR||':'||TIME_START_MIN ||':00','DD-MM-YY:HH24:MI:SS') -
(interval '00 04:00:00' day to second)
,12,5)
ELSE '04:00'
END) SUM2
FROM INFO
where id=:ID
What is the best way for the calculation: computation or processes or etc? The calculation after or before user push button(New:create button of Update:Apply Changes)?
How to fill the answer (SUM1 and SUM2) at table INFO?
Thanks Walter

I have something similar I use:
DECLARE
  str_day      VARCHAR2(10);
  dt_indx      DATE;
  db_dt_indx   VARCHAR2(20);
  str_st_tm    VARCHAR2(20);
  dt_st_tm     DATE;
  db_st_tm     VARCHAR2(20);
  str_ed_tm    VARCHAR2(20);
  dt_ed_tm     DATE;
  db_ed_tm     VARCHAR2(20);
  shft_flag    NUMBER;
BEGIN
  str_day    := :P1050_DATE_MM || '/' || :P1050_DATE_DD || '/' ||  :P1050_DATE_YYYY;
  dt_indx    := to_date(str_day, 'MM/DD/YYYY');
  db_dt_indx := to_char(dt_indx, 'MM/DD/YYYY');
  str_st_tm  := str_day || ' ' || :P1050_TIME_IN_HH || ':' || :P1050_TIME_IN_MI || ' ' || :P1050_TIME_IN_AM;
  dt_st_tm   := TO_DATE(str_st_tm, 'MM/DD/YYYY HH:MI AM');
  str_ed_tm  := str_day || ' ' || :P1050_TIME_OUT_HH || ':' || :P1050_TIME_OUT_MI || ' ' || :P1050_TIME_OUT_AM;
  dt_ed_tm   := TO_DATE(str_ed_tm, 'MM/DD/YYYY HH:MI AM');
  --Alter date if night shift
  SELECT NVL(:P1050_NIGHT_FLAG,0) into shft_flag from dual;
  IF dt_ed_tm < dt_st_tm THEN
    dt_ed_tm := dt_ed_tm + 1;
  END IF;
  db_st_tm   := to_char(dt_st_tm + shft_flag,'MM/DD/YYYY HH:MI AM');
  db_ed_tm   := to_char(dt_ed_tm + shft_flag,'MM/DD/YYYY HH:MI AM');
end;You'll need to modify it for your page variables.

Similar Messages

  • Form with report, where some items in the form have been given values.

    Hi, greetings:
    I have a question that maybe silly but annoying to me. I need to provide a form with report, where some items in the form have been given values automatically, and these items (display only) are supposed to show given values in the form automatically.
    I used the APEX form with report. The update and delete worked well. But I cannot show automatic values when insert. By default APEX insert form makes every item null; I tried to give value for two items: P5212_USERKEY, P5212_DAILY_VER_DATE with process before header, after header, after regions and before footer, and computation, or set values of these two items in the branch when user hit create button (submit). It never worked out, the two items always displayed null value, and when I insert, I got "ORA-01400: cannot insert NULL into ("TBSBI"."DAILYVERPRODNOTE"."USERKEY")", since I have set up constraint in database that these two columns should not be null.
    Could anyone help on this? any suggestion would be appreciated.
    Sam

    If you have made these values 'Display Only' they would by default not save the session state. Accessing the page items will always return NULL. Did you change the 'Save Session State' option to 'Yes'?

  • Creating a Form with Report based on View

    Hi All,
    I wanted to create a form with report based on two tables so:
    1. I created a view (called COMBO) based on two tables
    2. I then created a form with report based on the view
    Everything seemed fine thus far until I tried to edit existing records - I got the error:
    ORA-20505: Error in DML: p_rowid=2002082600001172, p_alt_rowid=REPATRIATION_ID, p_rowid2=, p_alt_rowid2=. ORA-01776: cannot modify more than one base table through a join view
    Unable to process row of table COMBO.NB: REPATRIATION_ID is the primary key of the Repatriation table. The other table is Applicant.
    & when I tried to create a new record - I got the error:
    ORA-01776: cannot modify more than one base table through a join view
    Unable to process row of table COMBO.Someone please enlighten me!
    Kind Regards
    Kamo
    Edited by: Kamo on 2009/03/12 2:33 AM

    Hello Kamo,
    You need to create an 'instead of' (update/insert/delete) trigger on your view to process the inserts etc into the 'real' tables.
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this reply by marking it as either Helpful or Correct ;-)

  • Image upload in  Form with Report

    Hello
    I have created a table FA_CUST_DTL
    Column Name     Data Type     Nullable      Default     Primary Key
    CUST_ID NUMBER      No          1
    CUST_NAME     VARCHAR2(1000) Yes          
    CUST_ADD     VARCHAR2(4000)     Yes          
    MOBILE     NUMBER(12,0)     Yes          
    PHONE     VARCHAR2(15)     Yes          
    EMAIL     VARCHAR2(100)     Yes          
    SIGNATURE_IMAGE     BLOB     Yes          
    MIMETYPE     VARCHAR2(200)     Yes          
    FILENAME     VARCHAR2(400)     Yes          
    IMAGE_LAST_UPDATE     DATE      Yes          
    Then i created a page Form With report with the trigger . After Browsing , images are not showing in my report.
    Can u tell me any idea abt it plz help me its urgent for me.
    Regards
    Geet

    If you need to control height and width of your uploaded images, then you must use the APEX_UTIL.GET_BLOB_FILE_SRC function. Please refer to this documentation:
    [http://download.oracle.com/docs/cd/E10513_01/doc/apirefs.310/e12855/apex_util.htm#AEAPI129]

  • Date Validation problem in form with report

    Hi,
    I am stuck on this date validation issue in a form with report that I am working on-
    I have an Active_date_start and an Active_date_end field. I want to validate the form in such a way that if the user enters the Active_date_end < active_date_start then it should error out appropriately asking to change the active_end_date . Also another problem is that the changes are made to the active_date_end they should reflect in the table. How do I accomplish this.
    Appreciate all the help offered.
    Thanks.

    Hi,
    Thanks for the code.Now the APPLY CHANGES works fine except that it throws an error when I change the end date to a date which is less than the start date . So it does show me my error and does not go further but also shows me the error -
    Invalid PL/SQL expression condition: ORA-06550: line 1, column 29: PLS-00306: wrong number
    or types of arguments in call to 'NVL' ORA-06550: line 1, column 7: PL/SQL: Statement
    ignored Invalid PL/SQL expression condition: ORA-06550: line 1, column 29: PLS-00306:
    wrong number or types of arguments in call to 'NVL' ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    I looked up the error number and it says its a generic error type where the error can be found on the line number specified. But in this case how and where do I look for the error line?. This is the code I am using-
    DECLARE
    vACTIVE_DATE_START DATE;
    vACTIVE_DATE_END DATE;
    BEGIN
    vACTIVE_DATE_START := TO_DATE(:P4_ACTIVE_DATE_START, 'DD/MM/YYYY');
    vACTIVE_DATE_END := TO_DATE(:P4_ACTIVE_DATE_END, 'DD/MM/YYYY');
    IF vACTIVE_DATE_END < vACTIVE_DATE_START THEN
    RETURN 'End date is before start date';
    ELSE
    RETURN NULL;
    END IF;
    END;
    My base table has the active_date_start as NOT NULL. Now I have the exact same code for APPLY CHANGES
    in other form and it works fine not giving the above error. I am at a loss to know how I can get rid of the error.
    Any suggestions!.
    Thanks in advance,
    A

  • Additional fields in report for form with report

    Hello,
    I got the problem, that I want to create a form with report where the form only changes the values of one table but the report is also using additional fields linked from another table. If I take a view with all fields for my form with report, the form is about all fields and not only about those from the first table. So is there a way to have another table linked to the form than to the report and get a link between them by a key?
    I hope that someone has got a great idea and can help me solving this.
    Thanks
    Jochen

    Jochen,
    you can create a form with report on the view and afterwards you change the SQL-query into a query on the view. Take care that the original column names remain the same. You get your extra columns in the report and your link to the form remains,
    good luck,
    DickDral

  • Form with report, update field in the form = field is not updated in table

    Hi,
    I have a form with report. On Primary Key in the report is a link to the form. I select one row in the form by choosing the link in the report. Then I update a field in the form and press "Save". I see the success message "Action processed" and I'll be back in the report. I see the field in the report with it's old content. It is not updated. I don't understand why. Can anybody help me?
    Thanks Daniela

    Daniela,
    Is the form field source set to the proper database column? It's either not properly defined or your Save button and the builtin update process have somehow become disconnected. Check to make sure that the Save button is set to perform an Update in the database operations setting.
    Earl

  • Form with report question

    Hi,
    I have developed all my forms of type 'Form with report' which after entering values, displays the report page that shows the details entered.
    In the form page definition I have a select list for customer id which diplays 'customer name' as return value. So after the form values are entered it redirects to the report page which displays the details such as customer id etc. How do I make this page to display the customer name instead of customer id. From user's perspective it would make more sense if he can see the customer name for editing/changes.
    Also I wanted to know which kind of report would be the most appropriate if the report is based on a PL/SQL block. Would it be as interactive ?.
    Appreciate all suggestions posted.

    Hi Zahid,
    Yes, That is exactly what I wanted. So now I have my other table (resources ) for getting the resource_name . I do not see any quotes in your query which makes me wonder how your query under – ‘Region source’ of the Region definition looks like. Could you paste you code exactly as seen there. Besides I am not sure if we can join tables in there. I was getting –Unable to parse query error as well as Invalid character. I am not entirely sure of the syntax of the query definition in the report page as it is automatically generated . Any ideas? . I am pasting my query here for you to look at.
    Appreciate your help.
    select "RR.RESOURCE_ROLE_ID",
    "RR.RESOURCE_ID";
    "RE.RESOURCE_NAME",
    "RR.ROLE_ID",
    "RR.PROJECT_ID",
    "RR.CREDITS_PER_HOUR",
    "RR.ACTIVE_DATE_START",
    "RR.ACTIVE_DATE_END",
    "RR.LAST_UPDATED_BY",
    "RR.LAST_UPDATE_DATE",
    "RR.CREATED_BY",
    "RR.CREATION_DATE"
    from "#OWNER#"."RESOURCE_ROLES" "RR",
    "#OWNER#"."RESOURCES" "RE"
    where "RR.RESOURCE_ID" "=" "RE.RESOURCE_ID";
    Thanks,
    A

  • Form with report Related

    Hi,
    I have created form with report.i want to apply the function like initcap,upper or lower apply changes portion of item.
    e.g when i click on pencil image to modify the value.item which holds the value.if i enter value in lower case.i want to make value in initcap format.how can i apply this function.
    Please help me to solve this problem.
    Thanks & regards
    Nisha

    Hi,
    First of all when do you want to make them Initcap? If its after submit, then you can handle it in your DML or at trigger level. If its before submit, you can go with JS.
    for those who prefer recursion over looping...
    <script type="text/javascript">
    function fnInitCap(pStr)
        var vReturn;
        if (pStr.indexOf(" ") != -1)
            // Initcap the first word
            vReturn = pStr.substring(0, 1).toUpperCase() + pStr.substring(1, pStr.indexOf(" ") + 1).toLowerCase();
            // Contains multiple words, call function recursively
            return vReturn + fnInitCap(pStr.substring(pStr.indexOf(" ") + 1, pStr.length));
        else
            vReturn = pStr.substring(0, 1).toUpperCase() + pStr.substring(1, pStr.length).toLowerCase();
            return vReturn;
    </script>and put following in item attributes..
    onChange="javascript:this.value=fnInitCap(this.value);"Regards,
    Hari

  • Use the same form with different button turned on in different calls

    Can I use the same form with different buttons turned on in different calls?
    Thanks!

    This is to avoid piracy. What could happen is, people could buy music, and give it away for free online. Usually it is then you buy a complete album off iTunes that it will only be available on one device. It is tied to that account, and the device must be registered to that account to listen to it.

  • Reset Select List in Form With Report

    Hi,
    i have Created Form with Report Page. I have three select List on this page.
    1-Market Name Select List with Redirect
    2-Customer Name Select List with Redirect
    3-Contect Person
    when i select market Name then Respective Customer name is select In to select List Customer Name.
    When i select Customer Name Then Contact Person is Select in Select List Contect Person.
    Problem is when i select Customer Name from Select List then Contact Person comes into Contact persion Select List But the value in select List Customer Name and Market Name is not dispaly , Display Only -Select Market - and -Select Customer Name- .
    I want when i select Customer NAme From Select List then value from MArket and customer Select List should not be reset.
    How can i do this.
    Thanks
    Edited by: 805629 on Jan 26, 2011 10:45 PM

    Try 'select list with submit', not "select list with redirect". Redirect usually doesn't save the values in session state so they are lost when the page repaints.

  • Question of Form with Report?

    This is great since I can create a form with report.
    For my search on form selection, I can only select one column, can I select more than one columns so I can search column A and B?
    Thank you.

    User,
    What is your name?
    Yes, when you're creating the report it's easy as you should see a list of columns and be able to select the ones you want. Afterward you'll have to manually modify the query which is easy enough.
    Regards,
    Dan
    http://danielmcghan.us
    http://sourceforge.net/projects/tapigen
    http://sourceforge.net/projects/plrecur
    You can reward this reply by marking it as either Helpful or Correct ;-)

  • Pdf form for data from another form with data, xml or pdf, tables not expanding

    Sir,
    I am using Adobe Acrobat 9 Pro and LifeCylce to do these forms. I have made several subforms for a Risk Assessment for the mission they fly. I have also made up another form with tables that would connect with each subform data. This form also will give me and others a % of the values received from the data to help us with seeing problem area towards Safety.
    I am able to connect the data to the form from the Risk Forms but when I go and add another group of data it over writes the data that was already in the data collection form. The tables are dynamic and able to expand with the generated data but when I compile several Risk Forms, xml. data into one single data group, the receiving tables will not except this data. To compile the data I am in Acrobat and using the form-manage form data-merge data to spreadsheet than enter as a report that is xml. Still not working. I also tried to save the form, with data already in the tables, and then opened it again and add data to it, it will over write the existing data in the form. This form does work great with the generated data in LiveCycle.
    Any suggestions???

    Thanks Paul
    Did as you said and for each subform binding tab made sure I have "Repeat subform for each data item" checkbox and still no change when I add the data.
    I even tried to combine the xml data and that file just has the main page and not the data pages. just another problem that is happening.
    Any other suggestions on this expanding tables and receive single forms one at a time.
    Bill

  • Are Output of reports generated stored in tables & fields in SAP?

    Hi,
    If a report is generated or if a scheduled job is executed, is the output stored in SAP tables & fields or just displayed on the screen.
    Thank You...
    Nag.

    Hi Rajesh,
    You are right that, If posting happens, obviously the data is going to be stored in tables.
    I am not talking about posting. I want to know if the job is scheduled for report generation (where there is no posting involved) whether the result is stored in tables or not. After executing SM37, we will select the job and click Spool right. I am talking about the report result stored there.
    waiting for your reply...
    Thank you,
    Nag

  • Form With Report om the same page

    Currently i usr a form to insert e a report to disply the results.
    However i'like tom link ther row of the report to fil the form with that data!
    I post a image to maque a picture
    http://diolicopia.pt/screenshot.jpg
    what i want to do it's whena click de report column... it fill the form with the records on the tablhe.
    thanks

    Hi
    You can use column link functionality to link a report table.column to corresponding form item. Best is to link through Primary Key column. Say the report has column Titulo so go to Edit Page>Report Attributes> clik on edit link against the Alias Titulo>Column Attributes>scrol down to section Column Link>
    1. enter some link text (choose one image)
    2. target=page in this application; page=enter page number on which you have form
    3. in the Name Value pair region in Item 1 row, under Name search for item name for Titulo e.g. P1_TITULO, under Value search for the column name value for Titulo e.g. #TITULO#.
    4. Click apply changes
    Now if you click on some value in the column Titulo in report the edit form will display data populated with records corresponding to that.
    Thanks,

Maybe you are looking for