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;

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

  • How to use NODIM func with out it's values being rounded

    I created a new calculated key figure in Query Designer 3.x, and used the function NODIM() - Value with out dimensions. When I use this function, the values are rounding off to the nearest value.
    For example, I have a value 0.000075 US$, when I use NODIM function the value is displayed as 0.000080. Value is getting rounded to nearest value.
    I tried using absolute value it did not work.
    Can any one tell me how to use NODIM function with out it's value being rounded to nearest value.
    Thanks,

    Hi,
    According to your description, you might want that "Notice" field has a default value when form is created and users can be able to change the value of that
    field.
    As a workaround, you can add an action rule in “Name” field via InfoPath to fill the default value in “Notice” field only when “Name” field is not blank and “Notice”
    field is blank.
    Settings of the rule are as below, you can modify it based on your need:
    Here is a link about how to add an action rule in InfoPath form, you can use it as a reference:
    https://support.office.microsoft.com/en-us/article/Add-rules-for-performing-other-actions-5322d726-b787-4e5f-8d37-ba6db68b451d?CorrelationId=8a64c12f-aa60-4d90-b1f9-a44fcc4e74b5&ui=en-US&rs=en-US&ad=US
    Best regards
    Patrick Liang
    TechNet Community Support

  • How to display JHeadstart flex item default values

    Dear All,
    I have defined a number of FlexRegions and FlexItems and I'd like to display the default values (specified by a SQL query in the Flex Item Def Editor) next to the input text field using the JSF EL expression #{row.defaultValue}.
    This works fine as long as the user has not provided a new value for the flex item. Once (s)he has done this, the default value gets cleared. I've been able to programmatically obtain the default value by invoking the method executeDynamicQuery("somename", row.getDefaultValueQuery()) on the FlexItemDefsOuterJoinedWithFlexItemsRowImpl instance, but
    I'd like to be able to always display the original default value in the .jspx page.
    Any suggestions would be greatly appreciated.
    I'm using JDeveloper 10.1.3.3. and JHeadstart 10.1.3.2.52.
    Regards,
    Ibrahim

    Hi Steven,
    Thanks for your reply. You're absolutely right of course. We wanted to provide functionality to submit 'request for change' requests, whereby we would display the current value of a given attribute (e.g. salary) next to the new value provided by the user.
    We wanted to 'misuse' the default value query aspect of flex items for this purpose. The flex item default value query would be used to retrieve the current value each time the request for change record is displayed.
    We managed to achieve this via a trick, so please consider this post as solved.
    Once again many thanks for a marvelous product.
    Regards,
    Ibrahim

  • Can you use a formula field as the default value of a parameter?

    I'm wondering if you can use a formula field as the default value of a parameter. I have an date parameter that is being pulled from a stored procedure. When I run the report, it defaults to the current date and time. I would like it to default to he current date and have the time be 00:00:00

    Hi,
    Unfortunately, you cannot use a formula field as the default value of the parameter.
    And, to get rid of the current time and show 00:00:00, all you need to do is Edit the parameter and set the 'Default Value' to 00:00:00. This will take care of the time portion, however the date portion would be set to the year 1899 and not the current date.
    Hope this helps!
    -Abhilash

  • How to use "discontinuation data" in BOM item ?

    Hi everyone!
    I would like to use "discontinuation data" in BOM item , not in MRP4 view, how to set? thanks!
    Dandan

    >
    dandan li wrote:
    >
    >
    > I want to know the  "discontinuation data" in BOM item, not  Priority of AltItemGroup !
    Dear Dandan Li,
    Plz Re-check Mr. SmanS Reply in that thread
    it is Regarding As per ur query
    More over Plz try to encourage your repliers always
    [committed quantity in production order;
    Like wise there are many other threads of ur's
    Plz Don't misunderstand
    Regards
    Madhu

  • How to use the TreeControl's active item indent level

    I am trying to query the indent level of an item in a TreeControl when I double-click the item.  I have an event structure that captures the double-click event.  In the handler, I read the Active Item:Indent Level property but it returns an error:
    Error 1135 occurred at Property Node (arg 1) in Viewer Main.vi
    Possible reason(s):
    LabVIEW:  The tree control's active item is not valid for this property.
    Property Name: Active Item:Indent Level
    Does anyone have code to show how to access the indent level for the Active Item?
    Thanks,
    -cb

    smercurio_fc,
    I may not be using the control properties correctly.  The help for Active Item:Indent Level indicates that it will return the Item Indent value for the active selected tree item.  The indent level indicates the depth in the tree at which the item exists.  For instance, a value of 2 indicates that the item is a Child of a Child of a Root node.  When I try to access the property, I get an error.  I have attached a simple VI (8.2.1) that shows the error and the basics of how I was trying to use it.  Can you point out my error or provide a corrected VI? 
    Thank you,
    -cb
    Attachments:
    Get tree control active item indent.vi ‏22 KB

  • How to use SPMetal to get the item's original field which named 'Created'

    I want to read the field which named 'Created' by using SPMetal,I found the 'Item' class has the property named '_originalValues', it seems to get the infomation about the original values.
    Is there anyone who has solved this kind of problems?

    Hi,
    By default, the Created, CreatedBy, Modified and ModifiedBy fields are not created by SPMetal, so we will need to extend our base entity class for accessing these fields in our
    code.
    Here is a link will show how to achieve this with steps in detail:
    http://weblogs.asp.net/uruit/archive/2011/05/05/linq-to-sharepoint-working-with-created-createdby-modified-and-modifiedby.aspx
    Best regards
    Patrick Liang
    TechNet Community Support

  • How to use external CSS for standard items ?

    Hi,
    I would like to use my external CSS style-sheet for the standard items I add to my portal page.
    I build an UI template with a CSS-link to my css style-sheet, and I used this UI template for my portal page. But it seems that items cannot use this UI template CSS reference.
    Is there a way to use external CSS on standard items (text, url,...) ?
    Thanks for your help,
    Best Regards,
    JC.AUDARD

    Easiest way I find to do it is to drop your css file in the portal/images folder. Make a hidden html portlet on your template and link to /images/mycss.css. You can then use it for many items such as text, links, html portlets, etc.

  • 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

  • Use button to assign page items a value

    Hi All,
    I have a simple question (hopefully).
    I need to assign two page items some value when a button is pressed. I cannot see what I'm doing wrong !
    I have created the button and set Button Request Source Type to PL/SQL Expression or Function. I have then added some code ;
    :p0_year := 2011;
    :p0_week := 37;
    This does not work, am I going about this the wrong way as I guess this should be pretty straight forward ?
    Thanks
    Billy

    Hi there billy,
    maybe you could use the Page Processing:
    Click the Processes plus sign,
    click PL/SQL,
    then name it,
    then in Point drop down choose On Submit After Computations and Validations,
    in Enter Pl Sql page process text area:  :p0_year := 2011;
    +:p0_week := 37;+
    click next,
    then next,
    then in 'when button pressed' drop down, choose the button you want to trigger the process above.
    then, click create process...
    You may also follow the advise from Zulqarnain by using dynamic action or javascript..
    Hope this will help..
    Best regards,
    shynn,,

  • Change Description of Service Item default value

    Hello
    in a service SC, on the item detail basic data, we want to change the default value of the field "Description of Service Item ". by default it is "Service Item" and we want to change it.
    Where can I change it excepted in BADI BBP_DOC_CHANGE_BADI
    thanks,

    Hi
    Which SRM version are you using ? What is your business requirement ? Do you want to change Service Item description value for every line item in the shopping cart OR
    the permanent text displayed on the Left side on the HTML Template.. ?
    <b>Incase you want to modify the HTML template Text, then it can be done using HTML Template modification.</b>
    Using Transaction SE80, In the Internet Service - BBPSC01, you need to find the relevant HTML Template and make the required chnages to the Description there as per your business requirements.
    All BBPSC* transaction are using the HTML sources of service BBPSC01.
    So you have to modify template SAPLBBP_SC_UI_ITS_300 from service BBPSC01.
    Make sure to publish the complete service on all defined sites so that changes can appear in all respective SRM Client systems.
    Related links ->
    BBPSC01 Template Labels stored where ????
    Re: Template Shopping cart
    Re: Internet Service flow
    Re: Need to change the field description
    Re: how to change descriptions of links on the shopping cart page
    How to change "vendor text " label in BBPSC01 and BBP_POC
    Hope this will help. Do let me know.
    Regards
    - Atul

  • How to hide PNP selection windows and set default values for PNP.

    Hi expert,
         I am using HR logical database PNP, but I don't want to display selection windoes for running program on PNP, whereas I want to set default value for some selection items in the program. could you please tell me how to get those two targets?
    Many Thanks,

    Hi
    You have mentioned 2 things.
    1. Don't want selection windows for running program for PNP - this can be achieved using the HR Report category - You can get more details on HR Report Category on
    HR Report Category
    2.  I want to set default value for some selection items - This you need to achieve in initialization event of your program.
    How you can get this can be explained by INITIALIZATION (SAP Library - ABAP Programming (BC-ABA))
    Thanks,
    Sreeram

  • XML FORM  -  How to save read-only controls with a default value

    Hello everybody,
    I have a 3 xml forms, each one to create one type of news. I need to use 3 because each of this forms has their own controls. But the control which indicates the type of news (asociated with a KM Predefined Property) must be common in the 3 forms, in order to use it on searches.
    The question is, how can I include in this forms a control:
      - Visible for the user
      - With a default value defined in the control properties (each form has a different value, corresponding with the type of news)
      - Read-only mode
      - The value showed in the control must be saved in the associated KM Predefined Property when the user clicks the Save button. 
    Anyone knows how to do this?
    What control can I use?
    I was thinking of trying with text boxes, but I don't find the way to make them unwritable (Read only mode).
    It is posible using labels?
    Thanks.
    Kind regards

    Hello Jose,
    I know you responded with a question... I see it in the email, but I don't see it here!  Very odd... but in response:
    The first thing I do when I open the Edit.xsl file is do a 'find' for the name of the text field that I want to be read-only (in my test case, it's 'location').  Repeat the find until you see something like:
    [code]<!--
    field location
    -->[/code]
    Below there is where I put the new code.  Mine looks like this:
    [code]- <xsl:choose>
    - <xsl:when test="location='' and ($editmode='create')">
    - <xsl:choose>
    - <xsl:when test="./xf:ValidationError/@tagname='location'">
    - <input name="location" size="30" type="text" class="urEdfiTxtEnbl" id="field_1157467268006">
    - <xsl:attribute name="tabindex">
    - <xsl:choose>
      <xsl:when test="$accessibilitymode='true'">21</xsl:when>
      <xsl:otherwise>3792</xsl:otherwise>
      </xsl:choose>
      </xsl:attribute>
    - <xsl:attribute name="value">
      <xsl:value-of select="''" />
      </xsl:attribute>
    - <xsl:attribute name="readonly">true</xsl:attribute>
      </input>
      </xsl:when>
    - <xsl:otherwise>
    - <input name="location" size="30" type="text" tabindex="3792" class="urEdfTxtEnbl" id="field_1157467268006">
    - <xsl:attribute name="value">
      <xsl:value-of select="''" />
      </xsl:attribute>
    - <xsl:attribute name="readonly">true</xsl:attribute>
      </input>
      </xsl:otherwise>
      </xsl:choose>[/code]
    I put the <xsl:attribute name="readonly"> in both places (when test, and when not test).  I'm not entirely sure if that's necessary, but that worked for me.
    Hope this helps,
    Fallon

  • How can I set the date today as default value in a parameter?

    Hi,
    I have in my report a date parameter and I want to set as default value the date today.
    How can I do this?
    Thanks in advance

    If you are using a datatemplate , you can have a beforereport trigger that will have a package call.
    In the package spec, define a date variable and also define the function beforereporttrigger that retruns boolean.
    In the body, define the beforereporttrigger function with
    begin
    select sysdate into specvariable from dual
    return(true);
    end;
    You can then use the variable in the datatemplate as :variable.
    Hope this helps.
    - Vasu -

Maybe you are looking for