Query to set item default value

I'm trying to set a default value of an item by using a query. The first thing I tried is setting the source value to be:
select 'TRDM-R-'||LPAD((MAX(SUBSTR(EXPAND_REQ_ID,8,3))+1),3,'0') EXPAND_REQ_ID FROM BANKSRG.TRDM_REQUIREMENTS;
with item display type as Text, source type SQL Query. This displayed the value in the form, but did not save to the DB. (I tried all the other display types for text too)
The next thing I tried (a suggestion for someone else in the forum) was set item display type is Display as Text (based on PL/SQL, does not save state), and the source type is PL/SQL Anonymous Block, with this query:
for c1 in
(select LPAD((MAX(SUBSTR(EXPAND_REQ_ID,8,3))+1),3,'0') EXPAND_REQ_ID
FROM BANKSRG.TRDM_REQUIREMENTS)
LOOP
htp.p('TRDM-R-'||C1.EXPAND_REQ_ID);
EXIT;
END LOOP;
but I get this error: Error ERR-9132 Error in PLSQL expression for item default code, item=P2_EXPAND_REQ_ID
Then I tried the above query in the Default Value section, with the same error.
I've also tried adding computations, but if i get the value to display, it still won't save to the DB.
I would greatly appreciate any suggestions!
Robin

In case anyone else is new to HTMLDB and needs the answer to this question, I finally figured it out.
In the Item the Display is Text Field, Source Used is Always..., Source Type Database Column, Source Value EXPAND_REQ_ID, Default Value &P2_EXPAND_REQ_ID., Default Value Type is Static Text...
Then I created a Before Region computation, type sql Query, entered my query in the computation,
select Condition Type Value of Item in Expression 1 is NULL, Expression 1 is P2_EXPAND_REQ_ID.
Not so difficult, it just took a lot of time to try all the options.

Similar Messages

  • HOW TO SET A ITEM DEFAULT VALUE  to today

    I have a item using select list and I like to set this item default value as
    today's date , such as "select to_char(sysdate,'YYYY-MM-DD') from dual"
    HTMLDB failed recongnize the default value, or throw error Error ERR-9132 Error in PLSQL expression for item default code, ...". I have tried each of 3 avaialable Default Value Types
    Per http://forums.oracle.com/forums/thread.jspa?messageID=443287, it is used to be doable, but the default value type (sql) is no longer avaialble in HTMLDB 2.0
    I would appreaciate it very much if anyone has successfully done this before, either set to today or current month

    Ching - Did you try a PL/SQL Expression using to_char(sysdate,'YYYY-MM-DD')?
    There have been no changes to the item default types available in HTML DB. The thread you referenced is for Oracle Portal, a separate and unrelated product.
    Scott

  • Set as default value the Item Category in the Maintenance Order

    Hello everyone,
    We are trying to find a user exit in order to set as default value the item category in the Maintenance Order once the Material has been introduced (Tag Components).
    SAP Customizing let the user set the Item Category automatically per Material Type, but we need to set different Item Categories to materials belonging to the same material type.
    We would really appreciate any help relating this issue.
    Thank you very much,
    Víctor Liedo

    Dear Paul,
    Thank you very much for your response.
    I had already tried customizing mentioned by Pithan, but it did not work because we need to set different Item Categories for Materials with same Material Type.
    We have been searching for exits which may let us set Item Category in the Maintenance Order, but it does not seem to be possible.
    What you say about adding some custom validation through user exit, not to set item category as default value, but to check if the one entered is valid, sounds the best way of achieving our commitments.
    I have tried to look for CNEX0037 & CNEX0038, by using transactions SE37 and SE38, search for programs and functions modules, but it did not work. Could you please tell us what kind of objects are?
    Thank you very much in advance.
    Víctor Liedo

  • Cannot set the default value of an item in the detailed table

    Hi,
    I have Master-Detail group, both are Table formats.
    I need to set the default value of an item in the details row to the value of an item in the selected row in the Master table.
    I tried Default Display Value=#{row.MasterItem}, but it seems it is trying to access current details row instead of the Master.
    I tried #{bindings.MasterGroupColumnName.inputValue}, but it does not work.
    Any ideas
    Thanks in advance
    Mohamed

    I think I now what I'm doing differently, I had the "New Rows" JHS property of the detailed table group "empty" instead of the default "2" value.
    It seems that "Default Display Value" expression works only for the new records specified in the "New Rows" property. But when I try to "Add" new record using the "Add Row" button, the new record inserted does not have the default values generated, only has values populated for the items of the FK (in the view link) but not the ones set through the property.
    I guess in a nutshell, how I can get the details item to behave like the FK columns?
    Thanks much
    Mohamed

  • How to set the default value of an item type DATE PICKER to the day of yest

    Hi
    How to set the default value of an item type DATE PICKER to the day of yesterday ?
    Thank you very much !
    Christian.

    Hi Christian,
    Have a look at this thread Re: Default the Date Picker to Today
    It covers this issue in detail.
    Regards
    Paul

  • How to use P_SESSION.GET_VALUE_AS_VARCHAR2 in MDform item default Value

    I have a master detail form based on two tables. In the DETAIL_BLOCK section I have an item named 'APPROVAL_STATUS' based on the column of the same name in the underlying table. I have an unassociated textbox named CURR_APPROVSTAT in the detail form for which I would like to set it's default value to the current value of APPROVAL_STATUS when the master detail form is opened in %3D mode via a hyperlink.
    I have tried using the p_session.get_value_as_varchar2 in the default value field of the CURR_APPROVSTAT item, but it generates errors on run.
    EX:
    Item CURR_APPROVSTAT
    default value field
    p_session.get_value_as_varchar2(
    p_block_name => 'DETAIL_BLOCK',
    p_attribute_name => 'APPROVAL_STATUS')
    Default Value type:
    Function returns varchar2
    on run, it generates error that p_session must be declared (I get the same error if I use portal.p_session... also).
    default value field
    select p_session.get_value_as_varchar2(p_block_name => 'DETAIL_BLOCK', p_attribute_name => 'APPROVAL_STATUS')from dual
    Default Value type:
    SQL returns varchar2
    on run, it generates and error that a right parenthesis is missing.
    I have also tried using the following in the Additional PL/SQL - before displaying form:
    p_session.set_value
    (p_block_name => 'DETAIL_BLOCK'
    ,p_attribute_name => 'CURR_APPROVSTAT'
    ,p_value => p_session.get_value_as_varchar2(
    p_block_name => 'DETAIL_BLOCK',
    p_attribute_name => 'APPROVAL_STATUS')
    on run, this generates the error identifier 'P_SESSION.GET_VALUE_AS_VARCHAR2' must be declared
    My questions are:
    1) is it possible to use the p_session.get_value_as_varchar2 in the default value field?
    2) If yes, then what if the proper syntax
    3) If no, can I set this value when the MD form opens from the additional pl/sql triggers, and if so, what is the syntax?
    any assistance you can offer is greatly appreciated.
    Sincerely,
    ARM

    In my detail block I have 10 rows displaying that may or may not have data after querying. To set the default value in the detail block, you have to set the index value of p_session.set_value. Since I don't know how many rows are already populated, I'm setting the default value to all 10 rows. Is there a better approach?
    Here's my code example, which I've placed in the additional PL/SQL section before displaying the form...
    DECLARE
    l_district_id VARCHAR2(7);
    BEGIN
    l_district_id := p_session.get_value_as_varchar2
    (p_block_name => 'MASTER_BLOCK',
    p_attribute_name => 'A_DISTRICT_ID');
    FOR i in 1 .. 10 LOOP
    p_session.set_value
    (p_block_name => 'DETAIL_BLOCK',
    p_attribute_name => 'A_DISTRICT_ID',
    p_value => TO_CHAR(l_district_id), p_index => i);
    END LOOP;
    END;

  • How to set a default value for a drop down list box and then apply cascading based on the default value in Infopath 2010.

    Hello Everyone
    I have two drop downs. Both are coming from look up fields from two lists. i want to set a default value(first list item) for the first drop down list box and then apply cascading based on the default value for the next drop down list box. I found one article(http://www.bizsupportonline.net/infopath2010/display-first-item-drop-down-list-box-infopath-2010.htm)
    where in i can set a default value but i can't apply cascading based on that default value. Any suggestions would be highly appreciated.
    Thanks
    Ramanjulu Naidu N

    Hey Ramanjulu,
    Take a look at the below article which I believe will answer your question.
    http://basquang.wordpress.com/2010/03/29/cascading-drop-down-list-in-sharepoint-2010-using-infopath-2010/
    Daniel Christian (MCTS)

  • How to set the default value of a LOV that is found in a view criteria

    HI,
    I need to set the default value of an LOV that is found in a view criteria. I tried to set a groovy expression but unfortunately it wasn't read. i also tried to bind the LOV to a bind variable and set the value of the bind variable in the constructor of my backing bean but unfortunately the default value appeared the second time i entered the screen and not on page load.
    Can anyone advise where can i set the default value,
    Thanks

    if you want some default value in LOV. you go to edit list of value wizard-> UI hint->include no selection Item checkbox -checked.use labeled item first of list- and beside that put the label. but when you try to get value, it will show null.but you can manipulate in ur java , if it default value

  • How to set a default value in a form, for a current record.

    Hello,
    I have created a form to store the details of an employee, details include employee id, name and lan id. I am wondering if it's possible to set the default value for an e-mail address. The e-mail address would be in the format '[email protected]'. So If I press 'create', I am directed to a form.
    In the forename field, if i type 'stewart'
    In the surname field, if I type 'Young'
    Then in the e-mail field, I should see '[email protected]'
    Furthermore, if I change 'stewart' to 'stuart', while still in the form, the e-mail address field is automatically updated to '[email protected]'
    Would anyone be able to help with this problem?

    Hi,
    to do this you need kind of interactivity in your form.
    You can achieve this either by:
    1) using JavaScript onchange-events on forename and surname items, or
    2) use the AJAX Computations option of ApexLib, see: http://www.oracle-and-apex.com/ajax-computations-rich-client-feeling/
    brgds,
    Peter
    Blog: http://www.oracle-and-apex.com

  • How  to set a Default Value  in Combobox

    Dear All,
    I want to set a default value in a combobox  when open the form. How can I set that?
    Default value : It is one of the options of the combobox.

    Im doing it as
      If BusinessObjectInfo.FormTypeEx = "150" And BusinessObjectInfo.BeforeAction = False And BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD Then
                oForm = SBO_Application.Forms.GetFormByTypeAndCount(BusinessObjectInfo.FormTypeEx, 1)
                Dim vepcombo As SAPbouiCOM.ComboBox
                Dim vepitem As SAPbouiCOM.Item
                vepitem = oForm.Items.Item("24")
                If vepitem.Enabled = True Then
                     vepcombo = vepitem.Specific
                    vepcombo.Select(10, SAPbouiCOM.BoSearchKey.psk_Index)
                End If
            End If

  • BC4J,Setting a default Value In a View With Data From An Other View

    hi
    I'm developping A BC4J. I want to set the default value of a field By counting the number of rows in an other view.
    So I want to instanciate the view and execute the sql statement and get the result.
    Is that the right manner to do it or not.
    can someone help me to do that
    cheers
    ghassen

    There's lots of ways to skin this cat depending upon whether you mean "database view" or "view object" when you say "view", and individual requirements.
    Given database views v1 and v2 with a common key between them
    select v1.x, count(*) from v1,v2 where v1.key = v2.key group by v1.x;
    either in the database view or in expert mode for the view object ( I think it'll take group by, but never done it ). ( assumption is that v1.x is a primary key for v1 )...
    Try this from sql*Plus first to get a feel for how this works.
    The catch with the above is that it is "static"... if you can ADD rows to v2 in your application... they aren't visible in the count until saved and requeried.
    Another way ( I think... hopefully Oracle folk will kibitz... )
    Create your own attribute on the view object like "TheOtherCount".
    In the view object's RowImpl, find the "getTheOtherCount". Find the count of rows in the second view object or entity object or rowSetInfo through the method of your choice. ( If you've already set up a master detail relationship that is active you can just get the rowcount! ). Refer to earlier postings on how to get the rowcount, or to create a dynamic view query to get the count.
    The nice thing is that this should reflect your counts even if the second view has added or removed rows... but will probably move like a snail.
    Note that if you have a need where you want the row count updated in a frame for v1 whenever v2 is added to or removed from... well... then you need to set up some sort of event listener to do a redisplay of v1's frame, I'd think? Since the attribute you've created in the view object is not based on an entity object attribute, it has no way to know when it has been "updated" via an additional or removed row from the target.
    I'm posting the above because no one has responded yet... it may form a place to start from. And maybe someone in the know will go "No, No, No... KKirk... it doesn't work that way at all!" and fill us in on how this can be accomplished!
    Good Luck

  • Set a default value for a radio button populated with a List of value

    Hi,
    I am using jdeveloper 11.1.1.3.0. I need to set a default value for a radio button populated with a List of value(Yes/No). Here's the selectonechoice code.
    <af:selectOneRadio value="#{bindings.Code.inputValue}"
    label="#{bindings.Code.label}"
    required="#{bindings.Code.hints.mandatory}"
    shortDesc="#{bindings.Code.hints.tooltip}"
    id="sor1" autoSubmit="true"
    valuePassThru="true" layout="horizontal">
    <f:selectItems value="#{bindings.Code.items}" id="si1"/>
    </af:selectOneRadio>
    I want to have the selectonechoice set to No by default. In the previous versions, I set the default value in the base attribute VO. But it is not working in the new version.
    Thanks

    Hi,
    this should work in JDeveloper 11.1.1.3 the same as in 11.1.1.2. If it doesn't then it is better to file a bug than to work around it
    Frank

  • A filter value for Query is set with some value automatically

    Hello SAP sourcing Guru!
    I created a query which has several filters.
    Some of Filter's type is VLV.
    When I preview the query somehow the filter values are already set with some value even though I did not set the default value.
    For example, filter name is Region and there are four regions: Asia, NA, Europe, and SA.
    I want to select one of them from drop-down menu. But Asia was already selected when I clicked the preview button for the query. I want to see "Please Select" instead of Asia from drop-down menu. I did not select "Prefill value from cache" for the filter. I made the filter Optional only. I did not set Default Value either for the filter.
    Any clues?
    Thank you for your response in advance.

    Hi,
    In the Default value field of the filter prompts, you need to mention the Class Reference ID of the corresponding field. E.g., if you have Contract document phase as a filter, then in that if you want to display a blank or none value, then you should use null:2016.
    Similarly for vlv type, the system has a value 616. Hence if you want to display a None value insteead of Asia, use the following in the Default value field:
    0:616:null.
    The way to find the class reference ID is to goto the RG > Class Reference > Look for the field that you are attempting to default on.
    Hope this helps,
    Vikram

  • Page item default value using PL/SQL

    Hello,
    I'm trying to set a default value for a text field page item in a form.
    I'm using this PL/SQL Function Body in the Default section:
    begin
    select ("DEPT_CODE"|| ' ' || DEPT_NAME) from MyView where UserID = :G_USER_ID;
    end;
    I get the following error:
    PLS-00428: an INTO clause is expected in this SELECT statement
    Any help is appreciated!
    thanks,
    Matt

    Matt
    I'm using this PL/SQL Function Body in the Default section:
    begin
    select ("DEPT_CODE"|| ' ' || DEPT_NAME) from MyView where UserID = :G_USER_ID;
    end;Well, that's not a PL/SQL function body. This is:
    declare
      x varchar2(4000);
    begin
      select ("DEPT_CODE"|| ' ' || DEPT_NAME) into x from MyView where UserID = :G_USER_ID;
      return x;
    exception others then
      return null;
    end;Scott

  • How to set the default value of selectOneChoice

    Hi All,
    I have two selectOneChoice(soc1 and soc2) in two respective pages with the same datacontrol.Now i need to set the default value of soc2 as per the value selected in soc1.
    For eg:-
    if user has selected a value in soc1 say "Bag" in the list then it should set the default value in soc2 as "Bag" when the second page loads.As both the selectOneChoice has been created using same data contol.
    How can i achieve this?
    Please suggest.

    Hi PR/Suresh,
    Thanks for your reply.
    My soc1 shows the employeeId like 100,101,102,103 but it holds the value as employeeName like Navn,Joy,Steve,Mark. I have used valuechangeevent to get the current selected value from soc1 but when i set the value in soc2 in its set property then the log says :-
    *<SimpleSelectOneRenderer> <_getSelectedIndex> Could not find selected item matching value "Navn" in RichSelectOneChoice[UIXEditableFacesBeanImpl, id=soc2]*
    My jspx page code of soc2 is :-
    <af:selectOneChoice binding="#{backingBeanScope.backing_temp2.soc2}"
    id="soc2"
    label="#{bindings.FirstName.label}">
    <f:selectItems value="#{bindings.FirstName.items}"
    binding="#{backingBeanScope.backing_temp2.si2}"
    id="si2"/>
    </af:selectOneChoice>
    and in my bean where i am accessing the value from valuechangeevent from soc1:-
    public void getValue(ValueChangeEvent valueChangeEvent) {
    BindingContext bindingContext = BindingContext.getCurrent();
    oracle.binding.BindingContainer bindings = bindingContext.getCurrentBindingsEntry();
    //for iterator name click binding tab in the jsf page
    DCIteratorBinding iter = (DCIteratorBinding) bindings.get("Employees1View1Iterator");
    int curIndex = (Integer)valueChangeEvent.getNewValue();
    Row datRow = iter.getRowAtRangeIndex(curIndex);
    String name = (String)datRow.getAttribute("FirstName");
    System.out.println("the new value is"+name);
    RequestContext requestContext = RequestContext.getCurrentInstance();
    requestContext.getPageFlowScope().put("value", name);
    and then i am setting it to the soc2 in backing bean :-
    public void setSoc2(RichSelectOneChoice soc2) {
    this.soc2 = soc2;
    RequestContext requestContext = RequestContext.getCurrentInstance();
    String val = requestContext.getPageFlowScope().get("value").toString();
    this.soc2.setValue(val);
    In this error i can predict that it is not able to find the 'Navn' in the list of soc2 because in the list it has employeeId which has corresponding value as name of that employee but how do i set the value in soc2 then.
    *<SimpleSelectOneRenderer> <_getSelectedIndex> Could not find selected item matching value "Navn" in RichSelectOneChoice[UIXEditableFacesBeanImpl, id=soc2]*
    Any ideas??
    Thanks

Maybe you are looking for