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

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);
    }

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

  • 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

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

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Error 11556: Can't share between some accounts on same computer

    I can't get iTunes (11.1.3) Home Sharing to work with this one account on my computer (Mini, OS 10.8.5). I've enabled it OK in my main admin account, and in one other account, but in my daughter's account I keep getting the error message: "Home Sharing could not be activated because an error occurred (11556)"
    I thought it might have something to do with the parental controld I'd set up on her account, but I turned them off and got the same error. I found one discussion suggesting it works to remove iTunes and reinstall it, but that seems drastic. I'm not even sure how to do a real uninstall, except for dragging the Application/iTunes icon to the trash. I hestiate to do that, considering all is working for the other accounts, but not this one.
    Suggestions? Thanks.

    I wound up fixing this myself, after reading some other posts.
    The key to making Home Sharing work was to enable access to the iTunes store in iTunes - something that was probably shut off when I turned on parental controls for that account. In the iTunes program, I navigated to iTunes...Preferences...Parental, and then unchecked "Disable...iTunes Store". Frankly I forget whether, when IHome Sharing was NOT working, that box was unchecked alone, or if the iTunes U box was checked, but when I unchecked them both, I was able to turn on Home Sharing. This is what the prefs window looks like when Home Sharing IS WORKING:

  • Some basic questions on File Adapter

    Hello all,
    I have some basic questions on XI and File Adapter and hope you can help me. Any answer is appreciated.
    1. Can I use NFS transport protocol to poll a file from a machine in the network, which is not the XI? Or do I have to use FTP instead?
    2. If I understand it correctly - when using the FTP-File Adapter, XI has the role of a ftp client. I have to run a ftp server on my distant machine. XI connects to FTP-Server and polls the file.
    Can it also be configured the other way round? The scenario I think of would be: FTP client installed on distant machine, which connects to FTP-Server(XI) and loads up a file. So XI would act as FTP Server.
    I know this works, if I install a ftp Server on the computer my XI runs on, and use the NFS-File Adapter to observe the folder. But I want to know, if I need a second, independant ftp server for this.
    3. And last but not least: When do I need the active ftp mode instead of passive?
    Thanx a lot for your answers!
    Ilona

    > Hello all,
    > I have some basic questions on XI and File Adapter
    > and hope you can help me. Any answer is appreciated.
    >
    >
    > 1. Can I use NFS transport protocol to poll a file
    > from a machine in the network, which is not the XI?
    <b>yes</b>
    > Or do I have to use FTP instead?
    >
    <b>also you can do it</b>
    > 2. If I understand it correctly - when using the
    > FTP-File Adapter, XI has the role of a ftp client. I
    > have to run a ftp server on my distant machine. XI
    > connects to FTP-Server and polls the file.
    > Can it also be configured the other way round? The
    > scenario I think of would be: FTP client installed on
    > distant machine, which connects to FTP-Server(XI) and
    > loads up a file. So XI would act as FTP Server.
    > I know this works, if I install a ftp Server on the
    > computer my XI runs on, and use the NFS-File Adapter
    > to observe the folder. But I want to know, if I need
    > a second, independant ftp server for this.
    >
    <b>XI cannot act as FTP server, but it is always a client. When XI is reading (File sender adpater) when XIis writing than it is File Receiver adapter</b>
    > 3. And last but not least: When do I need the active
    > ftp mode instead of passive?
    >
    <b>It depends on your firewall configuration. The best and the fastests is active mode but not always available.</b>
    > Thanx a lot for your answers!
    > Ilona

  • The battle to add some basic interaction to QuickTime?

    How do you actually work with quicktime files after the apparent death of Livestage pro?
    I've been searching, testing and loosing the battle to add some basic interaction to QT .mov's.
    livestage pro seams to be the only tool which actualy allowed creating interactive QT's. (I hope I'm wrong)
    My objective is to add a graphical PLAY button to the first screen of the clip.
    On the last screen I would like to put a play again button and play next, or playing next automatically after 12 seconds.
    Pulling the "next clip " from an xlm or data base would be great, I've found some Live stage project files to do that, but who knows if they still work with QT 7.*?
    I see that there's some posters on here with many post's.
    I'm gratefull for any assistance.

    Click on the pdf file on the left...
    http://developer.apple.com/documentation/QuickTime/Conceptual/QTScripting_JavaSc ript/index.html
    This will show you how to use text or graphics to make stop...play...etc for interaction in a Qt for the web. And it will show you how to click on text or graphics to call for a video into a div (video frame).
    And this one using buttons...
    http://www.kenvillines.com/archives/000008.html
    Easy to use...

  • Some Basic Queries

    Hi,
    Got some queries regarding Datawarehouse Builder 9.0.2
    1) How can i keep a track of records rejected due to validation Failures?
    2) How can i refresh the load based on date specified??
    These might be some basic queries. Just trying to learn how can i use this tool as per my business requirements.
    Thanks in advance. Any help would really be appreciated.
    Regards
    Biju

    Note that you're getting a fairly dumbed-down view of the whole virus issue so far.  People like to play word games with this topic.  It's important to understand that malware does exist for the Mac, so that you don't let a false sense of security behave in dangerous ways.  Of course, there's been several orders of magnitude less malware released for the Mac in the last 10 years than appears for Windows every day, on average, so you'll probably never see any malware...  but it's still possible.  For the full story on Mac malware, see my Mac Malware Guide.  (Note that my pages contain links to other pages that promote my services, and this should not be taken as an endorsement of my services by Apple.)
    Also, regarding whether the stock 13" MBP has enough memory for you, it is impossible to answer accurately without knowing what you plan on doing with your computer.  If you're a graphic designer, for example, who needs a lot of memory and power, 4 GB may not be enough, and for that matter, a 13" MBP might not be right for you.  What do you plan on doing with it?

  • Ability to do some basic editing to TL clips

    Ability to do some basic editing to TL clips would be great. If i made a title mistake i'd like to just re-encode that bit in PP & just bring it in to encore & insert it. Yes it can be done now somewhat but it is cumbersome & it would be nice to be able to lock the audio with video so they dont slide apart when adding to the TL in anyway. I have cs5.5.2

    OK, there's two different versions of the 5,2 the 2.0Ghz and the 2.13Ghz model.
    The model 5,2 (Early 2009, 2.0GHz Model Only) can use 6gb of 200 pin 667mhz PC2-5300 RAM
    The model 5,2 (Mid 2009, 2.13GHz Model Only) can use 6gb of 200 pin 800mhz PC2-6400 RAM
    These are good online stores for Mac compatible RAM
    OWC http://eshop.macsales.com/shop/memory/MacBook/DDR2/ - They offer Mac tested RAM at very good prices.
    Crucial Memory http://www.crucial.com/ - good place to buy RAM from all over the world. They also have an excellent memory selector that allows you to choose memory based on your computer's model
    Data Memory Systems http://www.datamemorysystems.com/apple-memory.asp - another good, cheap place to buying RAM if you live in the U.S.
    Here are instructions on replacing RAM in a MacBook with a removable battery. http://homeoffice.consumerelectronicsnet.com/articles/viewarticle.jsp?id=44404
    If you don’t have the tools to open up the MacBook OWC has a set for $5.
    http://eshop.macsales.com/item/OWC/TOOLKITMHD/

  • TS1559 The wifi just stopped working outside of the house. Now it's basically a calculator that I carry around with me.

    The wifi just stopped working outside of the house. Now it's basically a calculator that I carry around with me.

    That's nice.  Hopefully you'll have some mathematical problems for which to use your calculator.
    Meantime, did you have a support issue?

  • Some Basic steps How to tune this Query

    Hi All
    This is my cursor Query to fetch the Eligible orders its taking too much of time to execute, This is my query
    SELECT oeol.header_id,oeol.attribute1,oeoh.order_number,COUNT(1) consignment_count
    FROM oe_order_lines_all oeol,oe_order_headers_all oeoh,oe_transaction_types_all oett
    WHERE oeol.header_id = oeoh.header_id
    AND oeol.flow_status_code IN(DECODE(oett.name,xxhdnl_om_common_util_pkg.g_push_line_type,
    DECODE(oeol.shipment_priority_code,'EXPRESS',DECODE(oeol.flow_status_code,'AWAITING_STOCK'
    ,'AWAITING_STOCK','STOCK_RECEIVED','STOCK_RECEIVED'),'STOCK_RECEIVED')
    ,DECODE(XXHDNL_OM_QUI_BAT_PLAN_EXT_PKG.check_push_or_pull(oeol.line_id),'PUSH','BOOKED')))
    AND(oeol.shipment_priority_code=p_shipment_priority OR p_shipment_priority IS NULL)
    AND oeol.line_type_id =oett.transaction_type_id AND oett.name IN
    (xxhdnl_om_common_util_pkg.g_return_line_type
    ,xxhdnl_om_common_util_pkg.g_push_line_type )
    AND oeoh.attribute3 IS NULL
    GROUP BY
    oeol.header_id
    ,oeol.attribute1
    ,oeoh.order_number;
    Pls provide some basic steps for tuning regarding some performance.
    thanks & regards
    Srikkanth.M

    Hi
    as I tried to say is that DECODE is just hard to read, but not a performance issue.
    What do you do in the XXHDNL_OM_QUI_BAT_PLAN_EXT_PKG.check_push_or_pull(oeol.line_id) procedure?
    But let me try the DECODE... not 100% correct as I can't test but you'll get the picture:
    SELECT
    FROM
    WHERE oeol.flow_status_code IN
    CASE WHEN oett.name = xxhdnl_om_common_util_pkg.g_push_line_type THEN
       CASE WHEN oeol.shipment_priority_code = 'EXPRESS' THEN
          CASE WHEN oeol.flow_status_code ='AWAITING_STOCK' THEN 'AWAITING_STOCK'
               WHEN oeol.flow_status_code ='STOCK_RECEIVED' THEN 'STOCK_RECEIVED'
               ELSE null END
          ELSE
          CASE WHEN XXHDNL_OM_QUI_BAT_PLAN_EXT_PKG.check_push_or_pull(oeol.line_id) = 'PUSH' THEN 'BOOKED'
             ELSE NULL END
    ELSE
    NULL
    ENDThat is a 1:1 "translation" PLEASE add comments in nested statements.
    And this is easier to read, as in CASE you can use AND / OR / IN ....
    SELECT
    FROM
    WHERE oeol.flow_status_code IN
    CASE WHEN oett.name = xxhdnl_om_common_util_pkg.g_push_line_type THEN
       CASE WHEN oeol.shipment_priority_code = 'EXPRESS' AND oeol.flow_status_code IN ('AWAITING_STOCK','STOCK_RECEIVED')
         THEN oeol.flow_status_code ELSE NULL END
       ELSE
        CASE WHEN XXHDNL_OM_QUI_BAT_PLAN_EXT_PKG.check_push_or_pull(oeol.line_id) = 'PUSH' THEN 'BOOKED'
             ELSE NULL END
    ENDThe "oeol.flow_status_code IN" makes no sense as the output of/DECODE/CASE is always 1 value right? And I would use the logic on a select on table "oe_order_lines_all" and then use the calculated field as a JOIN criteria. Much easier to test and read.
    But, please check the procedure which you call that can be deadly! The "case" is just "nice to have"
    -- andy

  • Basic throughput calculations

    Hi all,
    I am doing some basic calculations for time it should take to transfer a file over my network. apparently its been a while since I had to do math as I am doubting myself!
    I just wondered how long it would take to transfer my 90GB file over a network connection that I knew to be 800Mbps.
    So I did the following:
    1Mbps = .125MBps
    800Mbps * .125MBps = 100MBps
    So thats 100 meg a second correct?
    1000Mb = 1GB
    90000MB = 90GB
    at that rate it should take roughly 900 seconds to transfer the 90GB file..or 15 minutes. is this right?
    TIA,
    R

    Your basic calculations are correct for time to transmit 90GB across 800 Mbps. In practice, due to frame/packet overhead, and how well stack deals with BDP (bandwidth delay product), actual transmission time might be considerably slower than the calculated value.

Maybe you are looking for

  • Sending an excel spreadsheet attachment on an E-Mail

    Afternoon, Based upon program BCS_EXAMPLE_5 I have created a program that generates an e-mail and creates a spreadsheet attachment. The problem I have is how do get the contents of an internal table into the spreadsheet attachment? My attempt at reso

  • PDF does not show up

    Hi all, The following is my code snippet in JSP for a project which i used to generate a PDF file. But the PDF does not show up . The Adobe loads and i get a pop-up saying 'Acrobat could not open 'Example[1].pdf' because it is either not a supported

  • Phone not working properly

     Iam using E 72. I have done the soft ware updation myself thru net. But still the phone is not working properly. While using the tutorilas, the graphics are coming but not the description. 

  • Length of "out char" parameter in stored procedure

    I call a SP with an output char parameter, the type is defined as a field in a table -- char(3), but when calling from stored procedure, it throws an exception: "ORA-01406: fetched column value was truncated" the exception happens in line 4: 1. stmt-

  • Can I convert call database to a printout? How?

    Can I convert call database to a printout? How? From a Treo 680. Post relates to: Treo 680 (Cingular)