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,,

Similar Messages

  • Button condition on page item and Validation error Conflict

    Hi,
    I have a select list page item and a button on page whose condition is based on the select list page item value(eg, If (:P2_item1='val1'){return true;}) with condition type=PL/SQL function returning boolean. This buttons submits the page.
    It' coming fine in normal case. However, if I select some value val2 from the list and then click the button, and if there are any validation errors (like mandatory check or email check fail etc), then the button disappears because it evaluates the button condition based on the changed value(val2), but the page has not yet been submitted because of validation errors.
    I think this can be solved if I create the button condition based upon database column value instead of page item as db col value won't change until the page is submitted.
    This look like very basic use-case and I would like to know if there is any better solution to this problem.
    Note: I am using Apex 4.2.1

    I don't want to show/hide the button on the change of the page item lov value, so i am not using Dynamic action.
    What i was is to make button visible based on a condition(which is based on page item), for which we have condition attribute of a button available.
    This is a very common thing where a user chooses the button condition as Value of item/column in expression 1 is null/expr2. But what if the user changes the page item value but it doesn't get submit due to validation error. In that case, the button condition fails.
    So, i guess i have to use column name in expression 1, can u tell how to do that?
    Expression 1 = IF (:P2_STATUS='val1') then return true;
    How to change the above to use db column 'status' instead? Any direct way(like #Status#) or I have to query db to get it using select.
    Any alternative approach?

  • 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

  • Using SQL Query for page item source does not insert populated value

    Hi All,
    Following are the attribute details of a certain page item on an edit form:
    Display As: Text Field
    Page Item Source Type: SQL Query
    Source value Expression: SELECT a from tab where id = 'ABC'
    Although the field appears populated on the screen, but the value is not inserted in the table.
    Can anyone help on this?
    Thanks in advance,
    Annie

    Annie:
    One solution is to define a pl/sql function that given a date will return the 'run-date'. Something like create or replace function get_prod_date(p_date in date) return date is
    retval date;
    begin
    select run_date into retval from tab_x where run_date=p_date;
    return retval;
    end;Change the Source Type for the page-item back to 'Database Column'
    Set Source value or expression to the 'database column name'
    Set 'Post calculation computation' to be
    get_prod_date(:pxx_date)
    Varad

  • Want a javascript redirect URL using an already defined page item?

    Hello,
    i have a button where i configure a Redirect to URL option... and use : javascript:html_PopUp('http://yahoo.com', '_newwindow');
    That is pretty clear, and it works. I also have a defined page item which does contain a valid URL
    For example :P4_OFFICE_WEB_PAGE_LINK_V:='http://google.com'
    I want the pop up to use a stored value, not the hardcoded one at the top... I have tried all of these, but none seem to work :
    javascript:html_PopUp('P4_OFFICE_WEB_PAGE_LINK_V', '_newwindow');
    javascript:html_PopUp(':P4_OFFICE_WEB_PAGE_LINK_V', '_newwindow');
    javascript:html_PopUp(APEX_UTIL.GET_SESSION_STATE('P4_OFFICE_WEB_PAGE_LINK_V'), '_newwindow');
    What should i use?
    Thanks.

    user12602240 wrote:
    I am a bit novice... sometime i don't know when to use a : (colon) and when not! And i certainly didn't know an ampersand symbol, page item name followed by period (.) will return the value stored. All covered in the documentation.
    Please update your forum profile with a real handle instead of "user12602240".

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

  • RE: How to branch a button to next page who's value is set as Submit

    Hi All,
    I'm using Oracle Application Express 4.1. I have created a page with 1 radio button and 2 drop down menu items, having On Load- Before Header Process(ie- package.procedure name with parameters as the (:P14_EFFORT_TYPE, :P14_PROJECT which are two drop down items on that page).The page has Next Button who's Action is Submit Page and I have branched it to other page (ie . a Report )after processing , but when i'm clicking the Next Button instead of going to the report page where the details of that process is to be displayed, its just refreshing the page .. on debuging its showing no data found , but that package.procedure is working absolutely fine at backend (i.e. in Sql Developer)..
    Any kind of documentation for help will be appreciated..
    Thanks in advance
    Gyani Tewari

    971387 wrote:
    Hi All,
    I'm using Oracle Application Express 4.1. I have created a page with 1 radio button and 2 drop down menu items, having On Load- Before Header Process(ie- package.procedure name with parameters as the (:P14_EFFORT_TYPE, :P14_PROJECT which are two drop down items on that page).The page has Next Button who's Action is Submit Page and I have branched it to other page (ie . a Report )after processing , but when i'm clicking the Next Button instead of going to the report page where the details of that process is to be displayed, its just refreshing the page .. on debuging its showing no data found , but that package.procedure is working absolutely fine at backend (i.e. in Sql Developer)..
    Any kind of documentation for help will be appreciated..
    Thanks in advance
    Gyani TewariWrong forum. This is General (database) questions, not specific front-end client application code. See Oracle Application Express (APEX)

  • Page Items displayed in Oracle AS Portal

    I am building a page in the Oracle Application Server Portal
    that has three regions. Each region contains a Discoverer Worksheet. The layout
    is such that the upper region has a worksheet graph (a) spanning 100% of the
    region. Beneath this region are two regions containing one worksheet table in each
    region. The worksheets have a master (b)/detail (c) relationship. The "master" (b)
    worksheet is the table for the graph (a) in the upper region. It is the same
    Discoverer worksheet being displayed as a graph in one region (a) and as a
    table (b) in another region.
    The issue that I have encountered lies in the Page Items
    being part of the title of the regions. For the tables, the Page Item and values
    appear just below the title of the worksheet. This is not the case for the
    graph. The page items do not appear by default. To get the Page Items to appear
    as part of the graph, I used the &PageItems option in Discover Plus for the
    worksheet, but this causes the values to be repeated for the regions containing
    tables (b) and (c).
    Is there any way to turn off the Page Item as being part of
    the titles in the regions containing tables? Or any way to get all three
    regions to show the Page Items without them being repeated in the regions
    containing tables?
    Edited by: user10753869 on Dec 31, 2008 7:50 AM

    Any ideas on this? I have tried the custom template and changed the border="1", but that does not look very good. I want it to look more like excel, where there are titles (column headings) and within each column, each cell has a border completely around it with page items in them. Is this possible?
    Thanks!
    Jeff

  • Disable all page items except one

    Hi All,
    Can any one please help me with the code. I have created a page with report from a table which has 5 values. If any user want to edit a row, he can do that by clicking the edit icon next to the row then the page redirected to another page with has a tabular form i created where there are 5 page items with values. I want to disable all the page items and enable only one item.the user can modify only one item which enabled, rest of the page items must be disabled. How can i do that. I have to use java script or is there any provision in apex itself?please help me....
    Thanks In Advance
    Meena
    Edited by: 793914 on Oct 19, 2010 2:05 PM

    Meena,
    My apologies. 3.2 also allows you to set the Page Item to Display Only. I don't know why I was thinking that was new to 4.0!
    By disabled, I assume you just want the current value to display, which would be null for a new record? It's not that you want to hide the disabled values, right?

  • Page Item In all !!

    I want to know if there are some way to know if discoverer execute the report with the page item in <all>?
    My regards.

    Hi user604420
    Discoverer will execute the report regardless of what's in the Page items. Page items are not the same as a condition, in that, regardless of what you select for Page Items, all values will come back. Page Items only change what you see, not what's queried. A condition is the only way to limit what is selected in the query.
    Hope that helps
    Nate

  • Anchored page item in chained frames

    Hi all,
    I'm using an "anchored object" page item with custom positioning, x reference is relative to the right border of the frame. The anchor is in a preceding paragraph (could be multiple lines away) in order to enable text wrap around that object. We recently have turned to use multiple chained frames. When the anchor is close to the bottom of one frame, this causes the object to show up below that frame rather than to follow its imaginary reference line, where it used to be in a single frame.
    Short from writing a script or plugin to do the adjustments, did I miss any built-in way to anchor objects so they follow the text flow of their surrounding (rather than their anchor) across frame breaks, and still allow for text wrap and frame relative x position?
    Version in use is CS4, but I'd also like to hear if CS5 has improved in this regard.
    Thanks,
    Dirk

    Dirk Becker  wrote:
    Hi all,
    I'm using an "anchored object" page item with custom positioning, x reference is relative to the right border of the frame. The anchor is in a preceding paragraph (could be multiple lines away) in order to enable text wrap around that object. We recently have turned to use multiple chained frames. When the anchor is close to the bottom of one frame, this causes the object to show up below that frame rather than to follow its imaginary reference line, where it used to be in a single frame.
    Short from writing a script or plugin to do the adjustments, did I miss any built-in way to anchor objects so they follow the text flow of their surrounding (rather than their anchor) across frame breaks, and still allow for text wrap and frame relative x position?
    Version in use is CS4, but I'd also like to hear if CS5 has improved in this regard.
    Thanks,
    Dirk
    Hi, Dirk:
    Some time ago, I think I found that the info here: http://www.adobepress.com/articles/article.asp?p=1324259 put me on the right path. IIRC, it has something to do with the position where the anchored object is inserted, which I think is at the beginning of the paragraph (again, IIRC I'm not rereading the article now.)
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • Convert page coordinate to page item coordinate

    Hello All,
    I have problem regarding co-ordinate system.
    I have Rects in page co-ordinate system  and want to convert with respect to pageItem co-ordinate.
    This Rects are resides within a frame, my requirement is to convert pagecoordinateRect to innerRect.
    I have tried using TransformParentRectToInner Or TransformPasteboardRectToInner  using IGeometry interface of page item.
    Left and Right points are converted but Top and Bottom points are not updated.
    Please help me to sort out above problem.
    Thanks
    Govind

    getUserPoint(int x, int y)
    Gets the user space point corresponding to the mouse click.
    getUserPoint in Java API converts from screen to user space ( lat/lon or whatever coordinate system you are using)

  • Convert page co-ordinate to page item co-ordinate

    Hello All,
    I have problem regarding co-ordinate system.
    I have Rects in page co-ordinate system  and want to convert with respect to pageItem co-ordinate.
    This Rects are resides within a frame, my requirement is to convert pagecoordinateRect to innerRect.
    I have tried using TransformParentRectToInner Or TransformPasteboardRectToInner  using IGeometry interface of page item.
    Left and Right points are converted but Top and Bottom points are not updated.
    Please help me to sort out above problem.
    Thanks
    Govind

    Not sure if this question should be asked in scripting or SDK forum, but this is definitely not the right place. The folks who hang out here don't do much coding.

  • Getting error message in debug "Page contains page items/buttons which are not assigned to a region!"

    Hi,
    I created a form and when I submit, it goes through but there is no "success" or "failure" message on Apex. I tried debugging it and got this message:
    "Page contains page items/buttons which are not assigned to a region!"
    I looked at the page definition and it seems like everything is assigned to a region. Much appreciate your help.
    Thanks!

    For your message, the relevant branch needs "include process success message" to be checked - and a value in success/failure in your process.
    Check the submitting & landing page for items not in a region. Under the items section there may be items listed separate to those under specific regions.
    It's possible these are related, but not guaranteed.

  • Before Header pl/sql process to assign values to page items

    How can i assign values to items on a page based on the data structure returned from a pl/sql procedure within the before header process? I am thinking of executing a pl/sql procedure based on a URL parameter value and then assign values to page items. Is this really possible using Apex 4.0.2? If yes, how can it be done?
    thanks
    Seetharaman

    The question isn't really clear. What kind of "data structure returned from a pl/sql procedure"? Please be much more specific.
    For a PL/SQL data structure such as record containing 2 elements (<tt>x</tt> and <tt>y</tt>) returned as an out parameter from a procedure to be assigned to 2 page items <tt>p1_x</tt> and <tt>p1_y</tt>, all that's required in the Before Header process is something like
    declare
      l_rec rec_type;
    begin
      the_proc(..., p_out => l_rec, ...);
      :p1_x := l_rec.x;
      :p1_y := l_rec.y;
    end;

Maybe you are looking for