Open page in new tab when dialog closed and request != DELETE - oracle-apex

I am using APEX 21.1. I have a report and a form. The form is dialog And is for creating and editing DEPT table's data. The report for displaying the same table's data. I should be able to open a page in a new tab after the dialog closes and the request was CREATE or SAVE. If the request is DELETE, the page should not open. The code for opening a new page in a new tab is in the report page's Dialog closed dynamic action. For example, run the report> edit a record> the click Apply Changes> the dialog is closed> the page is opened in a new tab. That was case one. Case 2: instead of clicking Apply changes, click delete to delete the record> the dialog closes> nothing happens.
ws= ESLAM_WS
un= forhelp
pwd= Forhelppwd$
app= Help
pages= 2 and 3

Not sure if you can use REQUEST for that. Check the documentation - 2.7.2.27.2 ... The value of REQUEST is available during each phase of the Accept processing. Once an application branches to a different page then REQUEST is set to NULL. So if you perform a DELETE request on the dialog, then the report will not know about that request value if the dialog page is closed. You could set a page item to that request value in the dialog page, return it to the calling page and have your dynamic action listen on change of that item.
So you'd create a page item P3_REQUEST and a process in the dialog page before the "Close Dialog" process to set that item with the request :P3_REQUEST := :REQUEST. Then use the dialog return item attribute to return that value. Create another item in the calling page and a set value dynamic action to set it's value with the request value returned. Then set a client-side condition for the DA that calls the new page in new tab.

I have created a page item P3_REQUEST and a process in the dialog page before the "Close Dialog" process to set that item with the request :P3_REQUEST := :REQUEST; and used the dialog return item attribute to return that value. And created another item in the calling page and a set value dynamic action to set it's value with the request value returned. Then set a client-side condition for the DA that calls the new page in new tab. Your answer was very helpful. Thanks.

Related

How can I refresh and show/hide buttons in Buttons Container in Modal Dialog in Oracle APEX based on an Item Value?

In Oracle APEX 22.1 (Oracle Database EE 21c) I have a Modal Dialog Box which has a button container with several buttons. These buttons are being shown or not, based on a item in dialog box variable that is 0 or 1.
When I press the button "UnDelete", a Dynamic Action of PL/SQL execution type is fired, change the value of a field in the database and then two another Refresh True Actions follow. The PL/SQL execution type changes the value of the field in the database of a table successfully and the first dynamic Action refreshes a Classic Report Region on the Modal Dialog Box showing the new correct value of the field.
The second Refresh True Action tries to Refresh the Button Container Region of the Modal Dialog Box in order to hide the button "UnDelete" and show the rest buttons, which all are Server Condition based on this variable value. The Refresh does not take place(maybe the Button Container Region does not support the Refresh Event or does not propagate it to its Buttons)?
How can I achieve this effect?
Thanks In Advance!
I tried the Refresh Action for the Button Container Region of the Modal Dialog Box,but the buttons are not shown/hide accordingly.
"Refresh" is not relevant for a button container. The "refresh" action in apex does an ajax call to refresh the content of a report - it just re-renders a part of the DOM containing data. Currently only the data rendered by a component can be refreshed using partial page refresh. A button can never "refreshed", it is rendered in the page rendering process and from then on it lives in the DOM for the lifespan of the page.
A server side condition is evaluated at page rendering time. If a server side condition yields false at page rendering time, the component is not included in the dom. So, they cannot be shown using a dynamic action afterwards (because they're not in the dom) and they cannot be re-evaluated using a dynamic action (because the dynamic action can only manipulate the dom and that condition was evaluated before the dom was rendered).
The solution to you problem is to use show/hide actions in a dynamic action for each of the individual buttons for the reasons explained above.

Refresh only one region instead of the whole page in oracle apex

I have made a region containing 2 display only items and a button.
The button performs some dynamic action (execute pl/sql query) and the page is refreshed every time the button is pressed (submit page action) .
Is there any way that on click of the button only that particular region gets refreshed instead of the whole page?
Also for the display only items, lets say
item_label ==> item_display_value
how to add this (==>) symbol in between?
If the page is submitted, then it will refresh completely - that is how apex works. But if a submit is not needed, you can add an action of "refresh" to the dynamic action and remove the submit. Make sure the "Behaviour > Action" property of the button is set to "Defined by dynamic action".
Note that not all region types support refresh, but all report types do.

Refresh function in Oracle - APEX 5.1

I'm using Oracle APEX to create a food ordering application. The application allows the user to add an item to their order through a popup window in which the user can select the quantity of the ordered item.
My problem is that after the user adds the item to the order from the popup window the popup window is only closed and the main page is not refreshed. I have a PL/SQL region on the main page that prints the items chosen along with their prices and quantity so that region needs to be automatically refreshed after the popup is closed. How can I implement that?
When saying a "popup window", is that a modal page? If so, how about a dynamic action on "Dialog closed"; a TRUE action would then be "Refresh".
Create a dynamic action on the parent page on dialogue close of the modal page which refreshes the region.

how to pass login credentials between pages in oracle apex?

I am creating a banking application using oracle apex. once the user have logged in using his customer id in page 2, his account details table should be displayed in the next page. I've tried with
select acc_no, bal from acc_details where cust_id= :P2_USERNAME
but I'm getting 'NO DATA FOUND'.
is this the correct way to do this? I've tried to use branches too. That was also not working.
On your first page, under the "Behavior"(APEX 5)/"Action When Button Clicked"(APEX 4) attribute of your log in button set "Action" to "Redirect to page in this Application". Then set the Target page number. Under that, you'll see the 'Set Items' part. Fill up that part by setting the "Name"(APEX 5) / "Set these Items"(APEX 4) with :P2_USERNAME and then "Value"(APEX 5)/ "With these Values"(APEX 4) with :P1_USERNAME. Get rid of the "branches" that you've created before or disable them at least for now.
if your user login name and userid is same (like email address)
you may use
apex_authentication.get_login_username_cookie
for getting username/user id at each page
or you can create an application item in shared component and assign user id to this item as
:MY_APP_ITEM := 'Hello';
after login and call it from all pages
Have you tried using :APP_USER? If that didn't work you could try creating an Application item as a value container for your cust_id. Just go to Shared Components >> Application Items then create an item. This way you could reuse the value on the application item until your session expire or you clear its value.
Say you've created an Application Item named "G_CUST_ID", you want to store your cust_id's value to G_CUST_ID. Create a PL/SQL process on your log in page and write the code below:
apex_util.set_session_state('G_CUST_ID', :P2_USERNAME);
The value set on G_CUST_ID will reset automatically on session expire. Don't forget to reset the value manually on Log Out.
apex_util.set_session_state('G_CUST_ID', NULL);

Accessing page methods from command in Sitecore

I'm building Sitecore sheer UI application. The main layout is aspx page NOT XAML, which contains a grid. I added a dropdown list as a ribbon button. When dropdown list changes, it must filter the grid source based on the selected value in dropdown.
When dropdown list changes, my custom command will trigger, but in the command I can't access my grid control so that I can do a filter. So my question is how can I call a method inside my aspx page from command class?
From your post I understand you have build an interface(.aspx page) which opens when user clicks dropdown value from the ribbon.
If this is the case then you can pass dropdown value in aspx page using querystring from your command file
In command file add following code
In execute method retrieve clicked value from CommandContext context:
Item item = context.Items[0];
In run method user SheerResponse to open aspx file:
UrlString urlString = new UrlString("youraspxpage.aspx?id="+(Dropdownvalue));
SheerResponse.ShowModalDialog(urlString.ToString());
In aspx file add following code to access which option you have selected from the
dropdown:
In page_load method access dropdown value from querystring, retrieve dropdown value and load grid:
string dropdownvalue= (Request.QueryString["id"]);
Let me know if the case is different.
Thx.