How to save current sysdate in apex - oracle-apex

I am using Oracle APEX to build an interactive report, in the edit page, there is a display only field called update time and the value is the last updated time. When I click submit page, I want to update this field to the current sysdate.
What I did is that I created a dynamic action which fires when page uploaded. The action changes the update time field to the current sysdate. However, this doesn't work. I am wondering if there is any other ways to do this? Thanks!

If you have a unique column in your table, you can create a procedure in page processing section and assign it to the submit page button. When you click submit button, procedure will update the update time field.
To make a page processing:
Go to Process section and click create button
Select PL/SQL Code as Process Type
Give a name to your Process
Write your procedure in field. You can assign a fields value like: update table set update_time = sysdate where ID = :P3_ID
You can define success or error message
Define your button to When Button Pressed section
Hope this helps.

Related

How to show blank data until refresh for direct query in power bi

I have created one report from Direct query.
Now the requirement is when we open the report, it should show blank data until user refreshes it.
When the user refreshes it the data should be shown.
How can I achieve this?
You can emulate this with some tricks:
Create a bookmark with no applied filters
Create a button and assign this bookmark as the button action
Filter your page to show nothing (apply some bogus filtering)
Save and publish report
This should make the report show nothing by default, and when the user clicks «show data» or whatever text you put on the button, the user is moved to the bookmark without any data filters, so the data is shown.
Outside of this method I can’t think of other means of showing data only when the user clicks refresh.

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.

Oracle APEX form on table, don't reset table pagination after changing values through the form

I have a form on top of a report, and when the user updates values in the report, the form pops up, they make edits, and then click "Apply Changes". There are many rows in the report and right now I have pagination set per every 15 pages. The report is set to enable partial refreshes so the data updates right after the user clicks "Apply Changes". However, if I am on any page other than the first page of the report, it resets the pagination and brings me back to the first page. Is there a way to update the report but stay on the page I'm making the edit for? That way the user can immediately see the change they made through the form.
I was able to solve the issue by using a Dialog Closed dynamic action executing the following javascript:
window.location.reload(false);
It refreshes the browser after the user makes edits, and the pagination does not reset. This is a workaround because the Refresh dynamic action resets pagination. Again this is in APEX 5.1.3.
Which Apex version do you use? I've just tried it on apex.oracle.com which runs Apex 20 and - no problem at all. Once I edit some value in a form, branch returns me to interactive report, to exactly the same page which I left.
Check branch's Behavior - it is set to redirect to page or URL, target is page where the interactive report is; check other properties for the target. Its action should be set to "None" (offered are: clear regions, reset regions, reset pagination which might be set in your branch properties).

Tutorial to create custom reports on Oracle APEX 5

I am new to Oracle APEX 5 and I am looking for a link or tutorial to achieve below.
Create a custom report with a parameter (date).
Go to shared components > report queries (add your sql statement with parameter. Test report with Bind Variables and works fine)
Under manage instance settings I have done the required configurations to print report in PDF
Go to share components > reports layouts (add rtf layout)
Add an item (date picker) on a page so that user can select a date.
Go to page and add date picker as an item. It works fine
Pass the date selected as a parameter to the custom report and generate output in PDF.
Under report query > session state, I have enabled include application and session information. There I selected the item I created on my page. The item name is the same name as the parameter name in my SQL script.
On my page I have also include a button that will trigger the report. The button is linked to the report by the URL.
This part fails and I am unable to get a report based on the date I selected in the date picker item.
I have done numerous research but could not find a single place where they explain how to proceed.
Any explanation, link or tutorial would be greatly appreciated.
For instance your page item which stores the date parameter is P9_DATE, you have to pass the page item P9_DATE as a parameter to redirect URL on button click as https://example.com/apex/f?P=&APP_ID.:0:&SESSION.:PRINT_REPORT=<REPORT_NAME>:::P9_DATE:&P9_DATE.

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