refresh of one report region in apex - oracle-apex

I have page with 10 clasic reports and 10 form region (one for each report). On each form region is button with Dynamic action witch
insert data in table. My problem is how to refresh just one report after I insert data so that new data is shown in report. I tried to add another
true action in Dynamic action (refresh region) but it has no effect. Anyone had any idea? Apex version is 4.2
Thanks in advance.

One thing you can do is.
Assign Static ID to your every reports, Like 'myReport1', 'myReport2' or what ever you want (ignore if you already did).
on each button click when you are updating database,
add one more True Action with Execute JavaScipt Code in your existing Dynamic Action.
and put $('#myReport1').trigger('apexrefresh');
repeat this for all of your Reports with relevant Report ID.

This is a frustrating issue and one which I have hit a few times...
Things to check:
Report region is region type: SQL query (PL/SQL Function body returning SQL Query - cannot be refreshed using a standard refresh dynamic action).
Ensure that: id="#REGION_STATIC_ID#" is in the Report template you are trying to refresh
Navigate to: Report Attributes > Layout and Pagination: ensure that "Partial page Refresh" is set to Yes.
Ensure that: any page item values which your SQL report is based on are submitted, these can be entered under Region Source in the "Page Items to Submit" box.

In the "Attributes" in "Pagination", "Partial Page Refresh" should be "Yes". otherwise classic report does not refresh.

Check if you have selected the Template "Standard" in Section "Appearance" of your Classic Report. This solved my problem with refreshing in Apex 5.

Related

How to add update buttons in rows of a Oracle Apex interactive report?

I created a report and a form separately rather than creating a "report with form" in my Oracle Apex application. Because of this there are no update buttons that appear on the left of every row in the report like it does when creating "report with form". How can I add these buttons such that I can use same form, which I am currently using just to create new records, to also update records?
I am assuming the report is in Interactive Report type.
Those are the ones which are normally created for report with form.
In which case if you go under the reports attributes the first one is Link,
by default it should be set to Exclude Link column. You should set it to Link to Custom Target, then define the link to go to your page and set the Primary key item.
And on your form page you also need to set an After Header process to fetch the row and fill the page items based on the filled Primary key. Or you can do something custom here, whatever floats your boat.

How to send report directly to the printer?

I am using Apex 18.2. and ORDS as a printing server.
I have a master-detail page for selling items with a form on a table as the master region and an IG as the detail, joined to each other through assigning the PK to the FK IG's column.
There is another page with a report that can be queried through number of page items to get the documents with items sold in the previously mentioned master-detail page.
Whenever a user creates a document and submit the page, I will need to send the data of that document directly to the printer.
I mentioned the report page because I thought redirecting to it and assigning the PK to the corresponding page item could be a suggestion. But I know that I can create a shared component> report query too. But I do not know how could I send the data directly to the printer in either way.
I do not know if the report type - IR, CR or IG would make a difference. That's why I just referred to "report". But I'd need to know how it could be done with all types of reports.
Here is how a real-world scenario would look like,
You enter a supermarket, buy some items, go to the cashier, pay for what you've bought and get a receipt. The receipt is printed when the cashier saves the invoice.
I know this is not how web apps work, but this is the task I am facing.
I can think of branching to the report page after the invoice is saved and setting the PK value to the corresponding page item in the "search criteria" region to get the corresponding data then execute "window.print()". But there will be two problems then. 1- criteria region would be printed too, unless I hide it with a dynamic action or else. 2- The "print dialog box" of the browser will be displayed.
APEX 20.1 added native support for PDF printing of Interactive Grid regions. See this video: https://www.youtube.com/watch?v=e1yIFcEdW_o
If you can't upgrade, or if that support isn't sufficient for your needs, I suggest taking a look at APEX Office Print: https://www.apexofficeprint.com/index.html
APEX Office Print(AOP) can provide you the right solution.
Please try out the solution posted in the below link.
http://dgielis.blogspot.com/2020/01/print-pdf-from-oracle-apex-to-local.html
Few more examples:
How to print to an IP printer:
https://www.apexofficeprint.com/ords/aop_web/r/aop_sample_app_web/5034?session=13740999314649
How to print directly to a zebra printer
https://www.apexofficeprint.com/ords/aop_web/r/aop_sample_app_web/zebra-printer?session=6208952429228
(OR)
https://dgielis.blogspot.com/2020/01/printing-to-local-zebra-printer-from.html
If you are redirected to the Home page,
-> Click on examples in the left side menu.
-> Click on Print(highlighted in yellow).

Hide a region on initial page load, show after button is clicked

I am setting up a report on a page with multiple checkbox page items and start and end date page items. The user clicks a 'Run Report' button to generate a report region below on the page.
The default selections for the checkbox items are all items selected, and the Start and End Date items have default options based SQL queries.
I want to the report region to hide on the initial page load, and then show once the user clicks 'Run Report'. I tried the following solutions:
Set region condition to 'Never' and then use a dynamic action to show the region once the button is clicked. However, I think the 'Never' condition trumps the dynamic action.
Create two dynamic actions, one on page load to hide the region and on clicking the button to show the region. However, the show DA is always overwritten once the page loads again because of the first hide dynamic action, so the region never displays.
Has anyone else run into this problem? Any solutions? Thank you!
You may like to consider the 'lazy loading' described on Maxime's blog.
https://askmax.blog/2018/05/18/lazy-loading-report/
Like you said, a server side condition will trump and DAs that are showing/hiding on the browser, as the region would never render.
If you want to hide something on entry, you can do something similar to what you described, but I'm not quite sure what you've done.
on load dynamic action to hide region (or add
style="display:none;" to custom attributes of region.)
on click of your button, show the region (do not run on initialisation), and
refresh the region.

ApEx 19.1 form region item value not passing on insert/create

I've been designing a new app in ApEx 19.1 and one of the form/reports which I have created will not save a specific column when I click CREATE (SQL Insert action). Debug data shows that the data is in the session state when the CREATE request is being processed. I have verified that the value is not inserted with the other columns by querying the table in SQL Developer.
When I click to edit the item, the page item is blank and the value is not in the session state. I can then choose a value, and it saves correctly (SQL Update action).
I have several other 19.1 form/reports in the app which do not have this problem.
Details:
-ApEx 19.1
-Modal Form page on an Interactive Report
-New Form Region, not legacy DML setup
-DATETIME column type, Date Picker item type
-Required column, Value Required = Yes (and errors occur correctly if left blank)
-The biggest difference between this page and others is that rather than navigating directly from the report page to this form dialog on Create, there is a different modal dialog form that must be filled, and then the user navigates to the form in question.
All of the other fields insert data correctly to their corresponding columns, and I haven't changed any of the Source settings after creation, so I'm not sure what is causing the issue. I've even deleted the pages and rebuilt them with the same results.
The issue had nothing to do with ApEx, and everything to do with poor DB & app design.
There was an insert trigger on the table which inserted a value to the column in question from an application item which had not been set.
I'll definitely clear that up to avoid future confusion.

DynamoDB Dashboard can't Save/Update Item: ConditionalCheckFailedException

I need to update an item in a table, using the AWS Console DDB Dashboard. But when I go into "Edit item" and click "Save", I keep getting a ConditionalCheckFailedException error.
I assume this means the existing item has a ConditionExpression which my new data is somehow violating. But I can't figure out how to view that expression from the Dashboard so I can determine what the issue is.
How can I view the ConditionExpression for an Item in a Table, from the AWS Console DDB Dashboard?
I had the same problem and with the help of AWS support have solved it.
The issue arises because the DynamoDB console for the "Items" tab is a static display which takes a snapshot of all your items when it is first displayed. If you select an item and then return to the screen you still see the same snapshot - it is not updated.
When you try to update an item, the console sends the values of all the existing fields from the snapshot for this item and if any of these fields differ from their current values in DynamoDB then the update is rejected. So the "conditional expression" is referring to the requirements which the console is making for the update to be allowed.
So the workaround is to perform a browser window refresh on the item list before selecting the item you wish to edit and then hope you are fast enough with the edit to finish it before any external updates to the table change the data. Of course if you have a rapidly changing table then you will not be able to be quick enough and so the console is not the right tool for the job.