How i can return dynamic success messages after submit page.
The message like " the deal create successfully your deal number tah-01-01-0001 "
Note the region type it's form, and i have column, the value for this column generate in database trigger like this value "tah-01-01-0001" the last four value '0001' changed sequencally i want to appear this value in message, how i can do that
The success message is allowed to refer to page items using substitution syntax, e.g.
The deal was created successfully. Your deal number is &P1_DEAL_NO.
You would just need to ensure that your PL/SQL process does set the page item value (e.g. P1_DEAL_NO in this example).
Related
There is a problem transferring values between pages in the application. I have 2 pages on the first page there is a variable P9_ITEMID (when you run page 9, in this variable SQL Statement query writes the data). There is a second page 181. I want to move data from variable P9_ITEMID to variable P181_ITEM. To do this, I use the 'redirect to page in this application' option. But it doesn't work. Although I see in the variable P9_ITEMID there is data. But when you go to page 181 but P181_ITEM is empty. I would be grateful for help))
P9_ITEMID is a virtual variable that is not assigned to any column in the table. This mmin simply displays data. When I start the page, I see the data that was written to it due to the dynamic action
also i tried to write the value in P9 ITEMID this way
My code:
declare
v_empname items.id%type;
begin
select id into v_empname
from items where id = :P9_ITEMID;
apex_util.set_session_state('P9_ITEM_ID', v_empname);
exception
when others then
apex_util.set_session_state('P9_ITEM_ID', null);
end;
I'm assuming that you have created a button with action: 'redirect to page in this application' and you want the session value of a page item to be passed to the target page.
When an url is constructed using link builder, the link is built at page rendering time. It does not pick up any changes in session. Even when you set the session state in a dynamic action, it will not pick it up because the url is already rendered.
To pick up any changes on that page, it is necessary that the page item value is set in session state and this is done by the "page processing".So if you use "Submit Page" on the button and create a branch to redirect to the page it will behave the way you want.
I have a form with a validation to check if the name entered already exists in the database and when submit button is clicked I want to proceed with an insert if the validation succeeds and if it fails, display a user prompt and if the user OK's it, then proceed with the update of existing record. I know how to do one of those at a time but not sure how to do this conditionally.
If I want to display a prompt I can use redirect to URL on a button click and set a prompt to whatever I want but how to only display a prompt when the validation fails?
Based on the followup comments, I would recommend the following:
Add a hidden item to the page, P1_NAME_EXISTS, for example. Ensure that its Value Protected setting is disabled.
Change the Action of the submit button to Defined by Dynamic Action.
Create a Dynamic Action on the click event of the button.
Make the first action an Execute PL/SQL Code action. Populate the Items to Submit property with the name of the item that has the name value you wish to validate. Then enter the PL/SQL code needed to see if the name is a duplicate. Set the value of P1_NAME_EXISTS to 'Y' or 'N' (or similar Boolean like values) within the PL/SQL code. Then put the name of the item (P1_NAME_EXISTS) in the Items to Return property of the action.
Add a second action. Set the Action to Execute JavaScript Code. Enter code like the following in the Code field:
var nameExists = $v('P1_NAME_EXISTS') === 'Y';
if (!nameExists) {
apex.page.submit('SAVE');
} else {
apex.page.confirm('This name already exists. Would you like to update the existing entry?', 'SAVE');
}
The JavaScript code will check the value of the hidden item after the PL/SQL process updates it. If the name doesn't already exist, then the page will just be submitted. If the name already exists, then the user will be prompted. Only if they click okay will the page be submitted.
You could change the value of the submit values if you needed to tell the difference.
You create a declarative Validation. If your validation condition fails, you'll see the error you define, instead of normal processing.
In this case you could have validation based on existence of a row.
If all validations are fine, then page processing will commence.
All computations, validations, and processes can be conditional - either a nominated button, or a condition often based on valid of :REQUEST.
Or, you could have a constraint on the table that fails when the value already exists, and handle that with your APEX error function. Why do a pre-check when you can rely on DB constraints?
I have a field on my page that I want to carry over to another page in the application.
On a button click I use "Redirect to Page in application" and set the page number to 2.
Now I want to carry over the value P1_MY_ID to page 2, so I used Set Items for target page:
NAME VALUE
_________ _______
P2_RECORD_ID &P1_MY_ID.
On Page 2, P2_RECORD_ID is a Select List filled from a shared LOV and its source is set to a database column.
Once page 2 opens, I do not see the value P2_RECORD_ID in a session state.
Am I doing something wrong?
Typically if an item has Source Type = Database Column, the Source Used will be "Always, replacing any existing value in session state". This means that on page load the item's value will be overwritten by the Automatic Row Fetch process.
In your particular case, it seems the value you are passing is the record ID - if this is a unique identifier for a record to retrieve from the database, you need to check that it has been set as the Primary Key Item in the automatic row fetch process.
Interesting but I just switch places for the items I am passing and it worked... Not sure why it worked but I'll take that...
I am attempting to call an APEX process from a dynamic action. i was able to do that via Execute Javascript code action, by using
apex.submit({request:'PROCESS NAME HERE'})
But I was wondering if there is a better way to do that, such as an APEX action
First to say (just to be clear) what you've written in your code as 'PROCESS NAME HERE' is not a process name (as those words might suggest) but a request value, as can be seen from your code.
You can do the very same thing using built-in APEX action:
Choose Submit Page as your Action
Enter your request value (aka the string you clouded with 'PROCESS NAME HERE') under the Request / Button Name field
Under the process you want executed set Server-side Condition as follows:
Type: Request = Value
Value: your request value (aka the string you clouded with 'PROCESS NAME HERE')
If you have other processes on your page as well that you don't want during this page submit, then you must do some of the following:
set their Server-side Condition to exclude that request (this is the easiest way if that process doesn't have any Server-side Condition defined yet): Type: Request != Value , Value: your process value
add that process value to excluding list for that process (either add it to the Value while using Request is NOT contained in Value type or change your Request != Value type into Request is NOT contained in Value if you've been excluding only one request before this)
I hope that helped and answered your question.
I'm developing an application in Oracle Application Express (APEX).
First page contains list of projects as a tabular report.
Clicking any of the rows forwards to the next page, where records can be edited. I've implemented it with following settings:
Link column: link to custom target
Target: Page in this application
Until this is fine.
My problem is how to pass actual report to the next page?
My table, which is the basis of the report has primary key (ID), and also owner & title combination is unique. Currently ID column is not included in the report.
Also the second page doesn't currently contain field showing ID, as this information isn't important to the users.
I know I could set ID column in report, and create a read only (even hidden) text box in the next page, however I'm looking for a more elegant solution. What is the standard way to solve this?
I wonder if you are asking: "How do I pass a value from page 1 to page 2 so page 2 can use the value to do a query and present the results. If so, here is how it's done.
On page P1, the report, for example, select the attributes for the report region under the region in the Rendering pane on the left of the page designed.
Under Attribute Properties on the right side, look for Link Column and set it to "Link to custom target". Then click Target.
Select the page and then in the Set Items section, on the left, under name, select the PK ID field to receive the passed value ex: P2_ID. On the right under Value select the field to pass the value, ex: #P1_ID# and click ok.
Now, when the link on page 1 report is clicked, the P1_ID is saved into Session state by Apex and passed to P2 which then performs a FETCH using the passed value.
You can read more about Session State here. Also, be aware there are security settings which affect what params can and can't be passed in the URL.
Clicking "Session" in the developer toolbar will enable you to see the session variables being passed.
If you mean "How do I store values in the app that can be accessed anywhere in the app - like a global variable" Then look at Application Items.
As always, please include version numbers in these posts.
When you create a target page let's say Page 3
And you create some items, let's say P3_ITEM_1,P3_ITEM_2, etc
You can assign values to each of them through the url in the original page
The complete APEX URL Syntax looks like this:
http://apex.oracle.com/pls/apex/f?p=AppId:PageId:Session:Request:Debug:ClearCache:Params:ParamValues:PrinterFriendly
Let’s take a closer look:
http:// – the protocol, can be http or https
apex.oracle.com – your domain/host/server, whatever you want to call it. Can also be localhost.
/pls – indicates that you are using Oracle HTTP Server with mod_plsql. If you are using APEX Listener or Embedded PL/SQL Gateway this part is obsolete/missing.
/apex – the entry from your dads.conf file (this a file on your application-server or EPG where the target database is configured) – in case of EPG its just one entry pointing to localhost, in case of an OAS you can have multiple entries, each pointing to an other database
/f?p= – procedure “f” is called and parameter “p” is set to the complete rest of the string. Remember: APEX uses mod_plsql. “f” is a public procedure, this is the main entrypoint for APEX. Or you could say: “f” is APEX.
AppId – the number or the Alias of the Application
:PageId – the number or the Alias of the Page
:Session – unique Session ID, can be 0 for Public Pages or empty (then APEX creates a new Session)
:Request – a Request Keyword. This is basically free text, just a string you can specify to react in a process or region condition on. e.g. you could pass the keyword “CREATE” and have a condition on the delete button of your page saying “dont’t display this button if request is CREATE”.
In other words: use the REQUEST to control the behaviour of your page.
When pressing a button, the button sets the REQUEST to the button-value (e.g. SAVE), so that you can control the processes in the page processing (Submit) phase.
:Debug – set to YES (uppercase!) switches on the Debug-Mode which renders debug-messages and timestamps in your Browser window. This helps to detect wrong behaviour of your page or performance issues and everything else. Every other value then YES turns the Debug-Mode off
:ClearCache – you can put a page id or a list of page ids here (comma-separated) to clear the cache for these pages (set session state to null, …). But there is more: RP resets the pagination of reports on the page(s), a collection name deletes the collection, APP clears all pages and application-items, SESSION does the same as APP but for all applications the session-id has been used in.
:Parameters – comma seperated list of page-item names. Good practice is to set only those page-items which are on the page you are going to. Accepts page-items as well as application-items.
:ParamValues – comma separated list of values. Each value is assigned to the corresponding Parameter provided in ParamNameList (first value assigned to first parameter, second value assigned to second parameter, and so on…).
The trick here is not having values which contain either a comma “,” or a colon “:”. Both would lead to side-effects and errors, as APEX gets confused when parsing the URL. Using a comma works, if enclosed by slashes: e.g. \123,89.
:PrinterFriendly – set to YES (uppercase!) switches the page into PrinterFriendly-Mode, uses the Printerfriendly template to render the Page. You can also hide regions or other elements in PrinterFriendly-Mode using the PRINTER_FRIENDLY variable in a condition.
In your case you'd use Params:ParamValues like this:
P3_ITEM_1,P3_ITEM_2:someValue_1,someValue_2
Documentation