Type/conditional default value for a form element

Hello

I have an interactive report with a form on the table 'A' who 'Who' has columns like 'CREATED_BY', 'LAST_UPDATED_BY '. Now, I'm auto these columns in the form with the & APP_USER. function. The scenario occurs when the 'P' user clicks on the button 'CREATE' on the report, these columns of the report get populated info P. After committing this recording, the "Q" user edit this record even with the link 'Edit' in this folder. The two columns get populated by the Q news, ideally only LAST_UPDATED_BY should get populaed by the news of the Q and not the CREATED_BY column, as it is the 'P', which created this record.

To do this, I guess that in the type of default value for these items, I have to use "Body of the PL/SQL function" instead of "static text with Session of Substitutions in State". Problem is to know how to code the filter: If the user pressed 'create' button or the button "Edit". Help, please

Thank you
Mary

Hi Mary

Usually, I would do this sort of thing on a trigger. However, you could do the conditional CREATED_BY field on the primary key of the record is null (which is itself a new record, but it must have a value of an existing record). The LAST_UPDATED_BY field should not be conditional, as it should be the name of the user who recorded the record.

Andy

Tags: Database

Similar Questions

  • Best way to set the default values for the form elements

    Hello

    I have a form with a lot of defaults that is mentioned below...
      Field                      value  
      created by             :APPL_USER
      creation_date         SYSDATE
      last_updated_by     :APPL_USER
      last_update_date    SYSDATE
      item1                     value1
      item2                     value2
    I am currently using calculation-> after presents... then when we create/update a record... these computaion takes place and the default value for the inserted values get... THIS WORKS PERFECTLY WELL.

    I want to know... If this approach is fine OR we can have a better approach to achieve...?

    Thank you
    Deepak

    Hello

    I think it's good if it fits your need.

    But why you have these fields in the form?
    created by: APPL_USER
    CREATION_DATE SYSDATE
    last_updated_by: APPL_USER
    last_update_date SYSDATE

    The user can enter the ones?
    I thought that those who are to audit and I would fill those drop with trigger in the database.
    So that you get the same "correct" values if you need to manipulate the data with example of sql client

    BR, Jari

  • How to set a default value for a page element

    I work with an array of facilities that has the name and the address. The user can add information to the contact person on a separate page. Because the address of the establishment and his contact is generally the same, I want to add a default value to the contact address. The installation page is on 201 and the link to add a new line of contact is on page 202. I showed in the default value: P201_street to the address of the contact. But, when I run the page, contact the address field shows the: P201_street, not the address of the actual plant. Do I leave? Must be something obvious?
    Thank you very much.
    Judy

    Hello

    Use: P202_STREET1 for PL/SQL expression, or just P202_STREET1 if you use the value of the item condition.

    See you soon

    Ben

  • Set a default value for SQL based LOV

    Hello

    Is there a way to set the default value in a LOV. Like let him say the LOV gets of the separate to_Char(date_field,'YYYY') in a table. I want the last year is the default value. Currently, since I was the null option also, when the page loads, the lov is always null. I need to change it manually.

    Thank you
    Sun

    You can easily set the default values for the dynamic element

    http://docs.Oracle.com/CD/E23903_01/doc/doc.41/e21674/bldapp_item.htm#HTMDB28287

    for example, select the default type in the body of the PL/SQL function and enter the following code

    declare
    v_return date;
    begin
    select max(date_field) into v_return from your_table;
     return to_Char(v_return,'YYYY');
    exception when others then
    return null;
    end;
    
  • Default value for the select list of type of form elements

    Hello

    I do not work with Apex that mutch, so this may be a simple question... but I still need help.
    I have a form, in this form, I have a question P19_ONTVANGER_ID, this is based on a LOV.
    This LOV is on a table that has a field of username with the value of APP_USER.
    The table looks like:
    ONTVANGER_ID this is the PK and is going to be the return value from the LOV.
    NAME is the display value for the LOV.
    USERID is the column APP_USER.

    What users would like to get is that if they create a new record, the default value for the P19_ONTVANGER_ID field is their own ONTVANGER_ID.
    But they must also be able to select another user.

    hope there is someone out there that can and will help me.

    Kind regards

    Rob

    APEX 4.0.2 Oracle 10

    Rob-v-M-Gn-Nl wrote:
    Until now, I had, but I need to select the value of the id of the table and the list of selection item appears the corresponding value.

    How can I do this?

    You can select the Type of default value as the body of the PL/SQL function

    and to add something like that

    declare
    v_return number;
    begin
      select your_id
        into v_return
      from your_table
      where some_column = :APP_USER;
     return v_return;
    exception when no_data_found then
     return null;
    end;
    

    http://www.asktheoracle.NET/PLSQL-function.html

  • Default value for an element of structure

    Hello

    I would like to know if it is possible to assign a default value to a structure element?

    Something like:

    struct {device
    int ID;

    Double position;

    IPAddress char [10] = '127.0.0.1 ';

    int TimeOut = 25000;

    };

    Thank you very much for your help!

    Best regards

    Mathieu

    Hello

    a struct is a data type, and you cannot assign a default value for it.

    You can assign a default value to a variable of type struct, with the following syntax

    struct device myDevice is {0, 0, "127.0.0.1", 25000};.

    Hope this helps,

    Aldo

  • Is there a default value for the color management in PSE10? Beautiful photos from iPhoto, but blur with elements. I need help with this before as I consider that the upgrade to PSE13 and beyond.

    Is there a default value for the color management in PSE10? Beautiful photos from iPhoto, but blur with elements. I need help with this before as I consider that the upgrade to PSE13 and beyond.

    Printing which forms an angle seems ok, but one that is horizontally seems faded, incomplete.

    I was wondering if I saved a layer somewhere and set it as a default value.

    If you group the layers, you will be left with a single layer, thus spreading your concern.

    Suggest that you do the following:

    1. Make sure you have the latest drivers for your printers
    2. Reset the default preferences.

    Hold the Alt, Ctrl + Shift keys when you click the icon to open the items. When asked if you want to delete the settings file, say Yes.

    Items nearby and let regenerate the file.

  • Form - different default value for each new line needed

    Hi all

    I'm a newbie in the APEX and now I am struggling with a problem in the form of tables.

    On my page, I report master detail, where the detailed part is created in a table form (I used the Wizard).

    Now I want to implement the following:

    When I click on the button that adds the line of tabular form, I want to assign the default value for the column 'LOGNO' in my tabular form. Value for this column is table extraction and I this value already stored on the page to display one element 'P210_LOGNO_ACT '.

    When I click on the button for one second third etc.) times I would like to set the default for the column LOGNO as LOGNO = P210_LOGNO_ACT + 1.

    Y at - it something simple, or is - this difficult to attribute the different value to each new row of tabular form?

    Version of the apex 4.1.0.00.32

    Thanks in advance!

    Jiri

    Inspect your column and find out the name of your column attribute, it must be something like fxx (f01, f02, f03... etc) and use this column instead of f11 (in my case, the name attribute is f11)

    Create a JavaScript function in your page header

    function myaddRow() {
    //perform standard addrow
      addRow();
      //set default value here
    //make sure you replace the P5_X with your page item name
      $s('P5_X',parseInt($v('P5_X'))+1);
      $('input[name="f11"]')[$('input[name="f11"]').length-1].value=$v('P5_X');
    }
    

    Change your button to add a line and call the function above, as shown below

    javascript:myaddRow();
    

    See this example of work http://apex.oracle.com/pls/apex/f?p=46417:5

  • How can you specify the default value for the undefined array elements

    According to aid LV, the tables have two default values, the normal default value and the default value for the undefined array elements.

    I assume that there must be a way to specify the default value for later, but I can't find it anywhere.  Any ideas?

    I know that you can drag the item out of the table container.  Change the default value on this scalar element.  Then drag the item in table tank.

  • The default value for a property with data of type boolean

    Hi all

    Is it a system preference setting, where the default value for a property with data of type boolean can be a Virgin? I want to keep the value by default in a vacuum, but every time I save the property even after empty selection, the default value changes to FALSE.

    Capture.JPG

    In this case Boolean doesn't help you, you mayneed to create a chain of ownership and have true/false / "" as your list of values

  • Display the default value for POPUP LOV

    Hello

    How to display the default value for the element whose type is LOV POPUP?

    Version 4.2 of the apex

    Thank you.

    Hi Sunil,

    Sunil Bhatia wrote:

    Change the default value to "SQL query"

    And set the default value:

    SELECT PERSON_ID PEOPLE WHERE USER_NAME = lower(:APP_USER);

    -Sunil Bhatia

    There is no default Type-> "SQL query".

    BO123 :

    Change the default value--> "Body of the PL/SQL function" Type and value by default to:

    DECLARE
    
      L_PERSON_ID PEOPLE.PERSON_ID%TYPE;
    
    BEGIN
    
      SELECT PERSON_ID
        INTO L_PERSON_ID
        FROM PEOPLE
       WHERE USER_NAME = lower(:APP_USER);
    
      RETURN L_PERSON_ID;
    
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
      RETURN NULL;
    
    END;
    

    Better make a packaged function and just call that work instead of writing all the code by default the value of the item.

    Kind regards

    Kiran

  • I'm writing sql that uses the value of a form element to calculate the value in the element anothet.

    Hi, I have a form that contains a single reference, name of the partner and three values. I am trying to add a new element that adds the three values based on the ID and displays the result.

    It's the sql which I use and it works if I type in a value for the ID fix, but when I replace it with 'P5_ID' I get the error below when the form is used. I can save the changes to the page OK.

    I would appreciate help with this.

    Thank you

    Steve

    Select

    ("Data_PSDM_Fcst". "' Month1_Act ' + 'Data_PSDM_Fcst '. "' Month2_Act ' + 'Data_PSDM_Fcst '. (' "Month3_Act") as "QT4.

    of 'Data_PSDM_Fcst' 'Data_PSDM_Fcst '.

    WHERE ID = P5_ID

    ORA-00904: "P5_ID": invalid identifier

    SteveKerry-Oracle wrote:

    Hi, I have a form that contains a single reference, name of the partner and three values. I am trying to add a new element that adds the three values based on the ID and displays the result.

    It's the sql which I use and it works if I type in a value for the ID fix, but when I replace it with 'P5_ID' I get the error below when the form is used. I can save the changes to the page OK.

    I would appreciate help with this.

    Thank you

    Steve

    Select

    ("Data_PSDM_Fcst". "' Month1_Act ' + 'Data_PSDM_Fcst '. "' Month2_Act ' + 'Data_PSDM_Fcst '. (' "Month3_Act") as "QT4.

    of 'Data_PSDM_Fcst' 'Data_PSDM_Fcst '.

    WHERE ID = P5_ID

    ORA-00904: "P5_ID": invalid identifier

    To use a value of element in SQL or PL/SQL of APEX block, use a reference variable to bind that precede the name of the element of the colon ("": "):

    select
        ("Data_PSDM_Fcst"."Month1_Act" + "Data_PSDM_Fcst"."Month2_Act" +"Data_PSDM_Fcst"."Month3_Act") as "QT4"
    from "Data_PSDM_Fcst" "Data_PSDM_Fcst"
    Where ID = :P5_ID
    

    I also highly recommend that you stop what you are doing now, remove all database objects that were created with identifiers respecting case-sensitive and re-create them according to standard practical Oracle so that they are case-sensitive. By the database SQL language reference:

    Note:

    Oracle does not recommend the use of identifiers in quotes for the names of database objects. These city identifiers are accepted by SQL * Plus, but they may not be valid when using other tools that manage database objects.

    Names of objects sensitive to case and between quotes identifiers will only cause confusion and error.

  • How to add the default value for the "Full - Text Search" box

    Hi all

    I am looking for the ability to add a default value for the "Full text search" box in the search form.

    Example:

    When the user accesses the search page it get default values for some fields (defined in the rule as default values) such as

    xField1 = txt1 and xFiel2 = txt2.

    and Furthermore we need full-text = Hello world.

    Is this possible?

    Another way that we use is to open the search by URL with coreContentOnly = 1 as a form:

    http:// < Server >/cs/idcplg? IdcService = GET_DOC_PAGE & to Action = GetTemplatePage & to Page = STANDARD_QUERY_PAGE & coreContentOnly = 1 & to xField1 = txt1 & to xFiel2 = txt2

    It is possible to add full-text criteria here? Somethig like: & text = Hello World

    Thank you

    Leon

    It is not possible in a very obvious way, not to mention that it is a rather strange request.  I can't really imagine a realistic use for this case.

    Anyway, without a messy customization, you should provide a default query with an FTX inside element text setting (i.e. "IdcService = GET_DOC_PAGE & Action = GetTemplatePage & Page = STANDARD_QUERY_PAGE & QueryText =Hello World" "")

    To do this in a profile in the secondary effects of the profile section, add the following:

    <$dpPromote("QueryText",>Hello everyone") $>.

  • Default values for Insert and Update

    What is the default way the current sysdate to a date on one column table when you perform an insert or update via a form? And related to this, what is the best way by default of the current user (APP_USER) for a varchar2 column when you perform an insert or update via a form?

    For these columns, I want to display in a report, but they must be hidden on the form, because I have the default app to sysdate and APP_USER values. However, when I tried to use the default values in table in 'the default UI settings' and using either: APP_USER or & APP_USER or SYSDATE, it shows that this literal value on the form (element is not hidden while to debug it). It does not show the actual value, I would, like "user1". Does make sense?

    Thanks for your help.
    -Reid

    I think that the triggers are the best device.

    Scott

  • How can I set a default value for a field from an LOV?

    The LOV are:

    Select txtName, ID
    of FAC_LK_PROJECT_PRIORITY
    order by 1

    I tried:
    Select the FAC_LK_PROJECT_PRIORITY priority code where txtname = "average";
    and set the type of default value to be the body of the PL/SQL function, but that did not work - I get this error:

    ORA-06550: line 2, column 1: PLS-00428: an INTO clause in this SELECT statement
    Error ERR-9131 in PLSQL function for default code point body, item = P19_PRIORITYID
    Ok

    The element is a list of selection w / db as the source column: PRIORITYID

    Assuming you want to provide a (default) value when the extraction process of line returns null for the element, a default value of body of the PL/SQL type function would be:

    declare l_id number := null;begin  for c1 in (select id from FAC_LK_PROJECT_PRIORITY priority where txtname = 'Medium') loop     l_id := c1.id;     exit;  end loop;  return l_id;end;
    

    Scott

Maybe you are looking for