Post Calculation Computation for Date/Timestamps

Hello,
I would like to know how to apply Post Calculation Computation for Dates/Timestamps?
I had trouble trying to add this to the Post Calculation Computation area:
TO_CHAR(:P1_TARGETDATE, :DEFAULT_DATE_TIME_MASK);
or should it be something more like:
SELECT
TO_CHAR(:P1_TARGETDATE, :DEFAULT_DATE_TIME_MASK) FROM DUAL;
What would be the correct code to allow me to format a date/Timestamp where a Application Variable of DEFAULT_DATE_TIME_MASK could be used as well. (I dont want to use the existing Format Mask.)

Just a hunch, but you might be having a problem because of the double quotes. Oracle likes single quotes. You also might want to forgo the quotes entirely.
As for an invalid number, is it possible that one of the values that you are adding might be NULL. You can't add NULL to a number or you get an error. There are two solutions to that. One would be to do an NVL around each number you are adding (changing it to zero if the value is NULL). The second option (and easier option) is to use the SUM function. Mathematical functions like SUM and AVG ignore those values that are NULL.

Similar Messages

  • Post Calculation Computation - Trim

    I have an item with the source type of Database column that's coming in with a single space.
    when display on the page the user has to delete the space to clear out the space.
    I've tried the "Post Calculation Computation" which is pretty straight forward with the Trim and the space still appears.
    What I've tried.
    Trim(:P8_FUND)
    Ltrim(:P8_FUND,' ')
    nullif(:P8_FUND,' ')
    Non of the above are working.
    When I tried the next statement just for a test, the space was removed and the xx appeared, so I can't figure way the above examples won't work????
    TRIM(:P8_FUND) || 'xx'

    I'm using Apex 3.2.
    I created a Trim function and added it to my Load_Start function and the item still has the leading space.
    Do you see anything in my code that's not right?
    HTML Body
    onLoad="Load_Start()";
    HTML Header
    function Load_Start()
    hide_item('P8_FRS_ACCT','P8_HIDE_COL1');
    hide_item('P8_FRS_SUBCODE','P8_HIDE_COL1');
    hide_popuplov('P8_FUND_CODE','P8_HIDE_COL1');
    hide_popuplov('P8_ORGN_CODE','P8_HIDE_COL1');
    hide_popuplov('P8_ACCT_CODE','P8_HIDE_COL1');
    hide_popuplov('P8_PROG_CODE','P8_HIDE_COL1');
    hide_popuplov('P8_ACTV_CODE','P8_HIDE_COL1');
    hide_popuplov('P8_ACCI_CODE','P8_HIDE_COL1');
    hide_popuplov('P8_LOC_CODE','P8_HIDE_COL1');
    hide_item('P8_FRS_OFFSET_ACCT','P8_HIDE_COL2');
    hide_item('P8_FRS_OFFSET_SUBCODE','P8_HIDE_COL2');
    hide_popuplov('P8_OFFSET_FUND_CODE','P8_HIDE_COL2');
    hide_popuplov('P8_OFFSET_ORGN_CODE','P8_HIDE_COL2');
    hide_popuplov('P8_OFFSET_ACCT_CODE','P8_HIDE_COL2');
    hide_popuplov('P8_OFFSET_PROG_CODE','P8_HIDE_COL2');
    hide_popuplov('P8_OFFSET_ACTV_CODE','P8_HIDE_COL2');
    hide_popuplov('P8_OFFSET_ACCI_CODE','P8_HIDE_COL2');
    hide_popuplov('P8_OFFSET_LOC_CODE','P8_HIDE_COL2');
    setFocus('P8_PAGE_FOCUS');
    trim('P8_FUND_CODE',' ');
    if ($x('P8_FI_ACCOUNT_TYPE').value != "F")
    {$x_HideItemRow('P8_FRS_ACCT');
    $x_HideItemRow('P8_FRS_SUBCODE');
    function trim(str, chars) {
         return ltrim(rtrim(str, chars), chars);
    }

  • Some basic post-calculation computation

    maybe I just have the syntax wrong....
    I'd like to default a field to the value of another field entered earlier in the same page.
    Say a customer has a short name and a long name.
    I don't want the long name to be blank, so it should contain the short name unless something better is entered.
    My ideal scenario is that if no long name is entered (ie the user leaves the field empty and moves onto the next field), the short name should be defaulted into the long name (and redisplayed, ideally). If this is not achievable, I would settle for pushing the short name into the long name field (and displaying it) to serve as a default before the user even has a chance to enter or skip the long name.
    I tried the following post-calculation computation
    IF P12_LNAME IS NULL THEN
    P12_LNAME := P12_SNAME;
    END IF;
    This gives a runtime error, complaining about the unexpected IF. (As an aside, can't the sysntax be checked at definition time instead of waiting until run time?)
    I'm not quite clear on whether these page items need a preceding colon or not, but the "IF" problem prevents me from experimenting with both naming conventions.
    I'm sure I could write a function to achieve the defaulting, and maybe I could also do something in the validations, but I suspect a more straightforward solution exists and I hope a more knowledgeable practioner can show me how silly I am.

    Sure. Now that I know how to validate with ease, I will be tightly checking all the user entered fields. I will default as we discussed earlier when fields are null, and other fields will be converted to upper case. all these fields will be entered into a series of fields in a single page region.
    what I'd like to do, before saving to the database, is to redisplay the same group of fields the user has entered, showing the modifed entries after my validations and post-calc computations, so that the user can see exactly what is about to be saved. I'd rather not have to create a whole new page just to do this if possible.
    I guess I just want to re-render the same page with the current page field values.
    CS

  • Post Calculation Computation example for query source

    Hello,
    It's my understanding that the Format Mask filed in the Source section of the Edit Page Item is for database columns. I've been trying to find sample code on how to use a format mask for a field that uses a SQL Query as it's Source.
    Here is my query:
    SELECT :P3_CONSTR_COST + :P3_AQUISIT_COST + :P3_SECURITY_COST + :P3_HOUSING_COST + :P3_DESIGN_COST + :P3_AWFEE_COST
    FROM DUAL
    Can you please let me know how I can format it to display like: 999,999,990
    Thank you for your assistance....

    Just a hunch, but you might be having a problem because of the double quotes. Oracle likes single quotes. You also might want to forgo the quotes entirely.
    As for an invalid number, is it possible that one of the values that you are adding might be NULL. You can't add NULL to a number or you get an error. There are two solutions to that. One would be to do an NVL around each number you are adding (changing it to zero if the value is NULL). The second option (and easier option) is to use the SUM function. Mathematical functions like SUM and AVG ignore those values that are NULL.

  • Calculation logic for date with respect to time.

    Dear all,
    In BI, i want to get the time for two different dates - how to caculate this
    For example
    Initial date :- 01.08.2007
    Final date :- 24.08.2007  - I want system to calculate the total hours between these dates - the logic should also be applicable if years,months and days are different.
    Regards,
    M.M

    Dear ....
    By subtracting final from the initial we will be able to get if the difference is only in days but if the month or year is differing will the same logic hold good - kindly explain?
    Regards,
    M.M

  • New imac will not find 2nd HD on old computer for data transfering?

    imac 2.16   Mac OS X (10.4.7)  

    Well, if the 2nd HD is just data (not a home directory containing prefs and other stuff) you can just finish the transfer from the 1st HD. Once you have the new Mac up and running, just start the old one with the T key held down, and hook the two together with the firewire cable. Both HD's from the old Mac should show up on the new Mac's desktop and you can transfer away.
    I'm just guessing, but I believe the setup app on new Macs only looks for the 1st HD.
    Jeff

  • ERROR-1079 Error in item post calculation computation

    hi,
    We are getting this error when the user is clicking on a "Submit" button. Below the error there is an Oracle -20000 (ORA-01422) error is getting displayed. In order to debug the issue i need to understand a way of knowing the underlying database procedure that is being called.
    Is there a role that we need to set which will give us developer access to the application that has been developed using HTML DB so that i can look at the procedure that is called from the button or is there some other way of doing so?
    Would appreciate your response on the same.
    Regards,

    Shalini - You need to use the service administration application to create a user in the workspace that owns your applications (Oracle). Use the url ../pls/htmldb/htmldb_admin (or the like) to get to the admin login page. After login, find the Manage Developers and Users link and select the workspace of your developed applications, then create a user account. Then logout from the admin application and login to the Oracle workspace with the new account credentials. Then you can use the Application Builder to examine all the applications in the workspace and you can export them too.
    Scott

  • Can you specify format mask for date or timestamp columns

    Hi,
    Recently when I'm developing a PL/SQL application, I find that any format mismatch between data in table and format mask specified in to_date/to_timestamp function will cause exceptions. However, I'd like to make my application more robust and immune to this kind of problems, and know exactly which format mask to use for exactly what columns in db table.
    Is there a way in a table column to specify the format mask for date/timestamp columns such that I can know exactly what format mask to use when doing conversion? Also I don't want to depend on NLS_DATE_FORMAT specification, don't want to make a long case statement to check for every date format allowed by Oracle.
    Many thanks.

    As per my knowledge it can't be possible
    casuse if you entered '12/11/2007' date
    how oracle know that in date 12'th is the month or 11'th.
    The person who entered that date will also have confusions in future.
    either you have to fix one date format for your whole application (application configuration).
    or you have to store the date format in other column of the table.
    In case you set the date column to varchar and store all the dates without format then
    in future you may face problems in future while fetching the records, searching etc.
    Regards
    Singh

  • Unable to set default date for Date Picker item using Auto Row Processing

    Okay, I have searched through the forum for an answer, and have not found a thing to account for my problem.
    First, does anyone know if using Auto Row Processing has problems updating an item/field in a record where the Source is defined as Database Column if the 'Display As' is defined as 'Date Picker (MM/DD/YYYY)'?
    I ask this only because I found out the hard way that Auto Row Processing does NOT fetch the value for an item where the field is defined as TIMESTAMP in the database.
    My problem is as follows: I have a form that will CREATE a new record, allowing the user to select dates from Date Pickers, text from Select Lists, and entering in text into a Textarea item. The information is saved using a standard (created through the Auto Row Processing wizared) CREATE page level button. After the record is created the user is able to go into it and update the information. At that time, or later, they will click on one of two buttons, 'ACCEPT' or 'DECLINE'. These are Item level buttons, which set the REQUEST value to 'APPLY' (Accept) and 'UPDATE' (Decline). The Accept button executes a Process that changes the Status Code from 'Initiated' to 'Accepted', and sets the Declined_Accepted_Date to SYSDATE, then another Process SAVEs the record. The Declined button runs a Process that changes the Status Code from 'Initiated' to 'Declined', and sets the Declined_Accepted_Date to SYSDATE, then another Process SAVEs the record.
    However, even though the Status Code field is updated in the database record in both Accepted and Declined processing, the Declined_Accepted_Date field remains NULL in the database record (by looking at the records via SQL Developer). WHY??? I looked at the Session State values for both the Status Code and the Declined_Accepted_Date fields and saw that the fields (items) had the expected values after the process that SAVEs the record.
    The following is the code from the Accept button Page Process Source/Process:
    BEGIN
    :P205_STATUS_CD := 'A';
    :P205_REF_DECLINE_ACCEPT_DT := SYSDATE;
    END;
    As can be seen, the Status Code and Declined_Accepted_Date items are set one right after the other.
    As an aside, just what is the difference between Temporary Session State vs Permanent Session State? And what is the sequence of events to differentiate the two?

    Here's yet another thing that I just looked into, further information...
    One other difference between the date field I am having problems with (Accepted_Declined_Date), and other dates (with Date Pickers) in the record is that the Accepted_Declined_Date never gets displayed until after it is set with a default date when the Accept and Decline buttons are pressed.
    One of the other dates that works, the Received Date, is able to write a default date to the record that is never typed into the box or selected from the calendar. That date is placed into the box via a Post Calculation Computation in the Source, which I set up as: NVL(:P205_REF_RECEIVED_DT,TO_CHAR(SYSDATE,'MM/DD/YYYY'))
    However, I do remember actually trying this also with the Accepted_Declined_Date, and setting the Post Calculation Computation did not work for the Accept_Decline_Date. Could this be because the Accept_Decline_Date is never rendered until the Status Code is set to Declined (in other words, there is no need to display the date and allow the user to change it until the record is actually declined)???
    The control of the displaying (rendering) of the date is set via the Conditions / Condition Type: Value of Item in Expression 1 = Expression 2
    Expression 1 = P205_STATUS_CD and Expression 2 = L
    Does this shed any light???

  • Post calculation on database column in form

    I have a form created. for post calculation I convert text to upper case.
    upper(NAME);
    When I edit existing data in the form, and save the record. The data is converted to upper case. However when I create a new record and save it, everything is in lower case? What am I missing?
    Thanks,
    Bob

    By saying "Post calculation", do you mean a Calculation with Computation Point "After Submit"? At the Edit Page, your calculation should be in the second column - Page Processing.
    Did you go to:
    1)Edit Page
    2)"Create" icon in Page processing/Computations region
    (There is also a "Post calculation computation" property at the item level (item properties - region Source. But this function is executed at page rendering - after the data is read from the source. It is not executed when the page is submitted. This will not work the way you require.).
    If you are using Computation with processing point After Submit, go to the properties of this computation and look for Conditional Computations - there shouldn't be any condition, or you should have there something like :REQUEST = 'SAVE' or :REQUEST='CREATE'
    Also in the Computation, you should have a colon in front of the item name. So if Px_ITEM is the name of your item, than the computation should look like:
    upper(:Px_ITEM)
    Check also, if you are using the same page for insert as for update. Some application wizards create a separate page for insert and separate page for updates and deletes.

  • Post Calculation Item Formatting

    I have a form item that is not a database column. The data is a number and I would like to format it as currency. I have entered the following in the Post Calculation Computation area but am getting an error message:
    TO_CHAR(TO_NUMBER(:P25_RO_BASE_RENT), 'FML99.99')
    I have also tried without the TO_NUMBER.
    Any suggestions? Thanks.

    This is what I have under Source:
    Source Used: Always, replacing any existing value in session state
    Source Type SQL Query
    Maintain session state: Per Session
    Source Value:
    SELECT new_base_rent
    from v_las_last_change_values
    where lease_id = :P25_ID
    --Charlotte                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Using a "Posting Key" relevant for the calculation of sales

    Hi All,
    if I make a posting by F-02 using a "Posting Key" relevant for the calculation of sales, I wonder: in which table SAP registers the data of sales?
    Is there the way to modify the relevance for sales of that posting?
    Thanks

    Hi
    As far I know, sales figures are getting updated in the following summary tables:
    KCN1 for Customer related.
    LFC1 For Vendor realted.
    Regards

  • How to search a .csv file for data using its timestamp, then import to labview

    Hi, I'm currently obtaining density, viscosity and temperature data from an instrument, adding a timestamp and writing it to a .csv file which I can view in Excel. This works fine (see attached code) but what I need to do now is to search that csv file for data which was obtained at a certain time, import the temperature, density & viscosity values at this time back into Labview to do some calculations with them, while the data acquisition process is still ongoing.
    I've found various examples on how to import an entire csv file into labview, but none on how to extract data at a specific time. Also, whenever I try to do anything with the .csv file while my data acquistion VI is running, I receive error messages (presumably because I'm trying to write to and import data from the .csv file simultaneously). Is there some way around this, maybe using case structures?
    If you need to know my skill level, I've been using Labview for a few weeks and prior to that have basically no experience of writing code, so any help would be great. Thanks!
    Solved!
    Go to Solution.
    Attachments:
    Lemis VDC-30 read registers MODBUS v5.vi ‏56 KB

    It sounds as if you are going about this a little backwards writing to a data file and then extracting from the file but its the weekend so I can't think of an improved way to do it at the moment. 
    Searching for a specific time with those specific values is quite easy, or if you wanted to select any time then you could interpolate the values to find any value that you want (This is where the contiguous measurement comes in, as you have readings at discrete times you will have to interpolate the values if you want to get the 'measured value' at a time point that is not exactly one of your measured points).
    If you can extract the TDMS time column and the T, D & V then simply thresholding and interpolating each of your array/data sets should allow readings at your desired times.
    Attachments:
    Interpolate.png ‏301 KB

  • Calculations for data collection

    Hi,
    In 'formula' type parameter for data collection, for the first time when operator enters values, the formula parameter does the calculation and give results.
    However, if later on the same data is edited, then the calculations donot take place and operator himself has to calculate and update the field.
    foreg: P1 and P2 are 2 parameters under 1 DC group.
    P3=P1+P2.
    When operator enters for the first time values for P1 and P2, P3 gets calculated. However, If later on values for P1 and P2 are edited through 'data collection edit' activity, P3 calculations donot change and operator has to calculate it and re-enter in P3 field.
    This is my understanding, please correct me if these calculations automatically takeplace whenever the base values are edited .
    Thanks.
    Regards
    Mansi

    nimaq,
    One of my more astute coworkers (a know it all, so he thinks, hehe), reminded me that we do sell a PCMCIA/Cardbus PXI Chassis controller and a ExpressCard PXI controller (if you have a computer with an ExpressCard slot).
    Cardbus controller link...
    NI PXI-CardBus8310
    ExpressCard controller link...
    NI PXI-ExpressCard8360
    If you buy a PXI controller for your Laptop, a PXI Chassis, and a PXI digital frame grabber, then you will have a system that allows you to grab images from your digital camera via your Laptop.  If you have not yet purchased a Laptop, I highly recommend you purchase a Laptop with an ExpressCard slot (they have much higher bandwidth) which you will want for frame grabbing.
    Below is a Link to a 4 slot PXI Chassis...
    NI PXI-1031
    Below is a Link to a Digital PXI Frame grabber...
    NI PXI-1422
    Buying these 3 products (PXI-ExpressCard8360, PXI-1031, and the PXI-1422) and the proper laptop, will give you a top of the line digital camera acquisition system.
    Lorne Hengst
    Application Engineer
    National Instruments

  • Standard IDOCS, Programs for posting FI & bank related data.

    Hi,
    (1)Are there any idocs available for posting FI documents, Vendor master?
    (2)Are there any outbound idocs, programs for sending data to banks. EG:positive pay etc?
    Kindly reply to these questions. Correct answer will be awarded points.
    Regards,
    Akshaya.

    Hi,
    There is message type BANK_CREATE for posting the FI related Bank details. Using the change pointers you can trigger the idocs for posting the bank related data.
    Regards,
    Uday

Maybe you are looking for