I want to make an interactive report which as one parameter (a date picker),based on the date selected I want to load/refresh my interactive report respectively and the datepicker item will be submitted to load report.
I have already tried by submitting the datepicker item,used Dynamic Action to Set its event to "change" then set it's true action to "submit page".But No result is displayed.
Here is my report query:
select * from TRN_SUMMARY where (:P2_DATE IS NULL) OR to_char(REP_DATE,'DD-MON-YYYY')=:P2_DATE;
I've just tried it - works fine.
I presume that WHERE clause you wrote is invalid. Try without TO_CHAR (why would you need it? Date picker is a date), e.g.
select *
from TRN_SUMMARY
where :P2_DATE IS NULL
OR REP_DATE = :P2_DATE;
Related
I'm pretty new to APEX and programming as a whole, so bear with me. I have a table I created using dynamic PL/SQL and have a TO and FROM datepicker to set the range of rows to select. It is functioning great so far but I'm having a problem with the defaults for both datepickers. I've set the FROM datepicker to default to one year in the past and the TO datepicker is set to the current date. I've set them both using a SQL expression in the default field. Whenever you change the date and refresh, the table selects the correct rows. BUT if you want to remove the dates in both pickers so that you can see every row in the table, the null values are being reset to the default values after refreshing the page. I feel like there's probably a very simple way to fix this, but I'm at a loss. Any help with this would be greatly appreciated!
An item gets its value from session state; if it doesn't exist, then from source; if it doesn't exist (and the item is still NULL), then default value is used.
Therefore, what you did is just the opposite of what you want - if everything else is NULL, default value is used.
What to do? Don't set default value for the item - use it directly in report's WHERE clause. Something like this:
select whatever
from your_table
where some_conditions
and date_column between nvl(:P1_DATE_FROM, add_months(trunc(sysdate), -12))
and nvl(:P1_DATE_TO , trunc(sysdate))
So:
if P1_DATE_FROM and/or P1_DATE_TO are set, these values will be used
if they are NULL, they will be set to previous year and today
Of course, you'd remove both item's default values.
Version: Oracle 18.2
I have an interactive report in my application. When I click the 'delete' icon, I want to delete information about the user I selected. Is there a way to get the value from the 'Facility Manager' column so I can use that value in a select statement to perform the delete statement.
I've tried to do it by using the ROW_ID variable (:selected_rowid) but this didn't work.
+ Interactive Report Image
+ Set Value statement
The column value is referenced by hashes, e.g. #STUDENT_ID#.
Have a look at what Jackie McIlroy wrote, "Delete a Row of a Report with a Dynamic Action" (https://jackiemcilroy.blogspot.com/2018/03/delete-row-of-report-with-dynamic-action.html) . She describes the process in details, with a lot of screenshots.
If I were you, I'd do one of the following:
use an interactive report with a form (and navigate to the form in order to delete a row)
if it has to be a tabular layout, I'd try
the old tabular form
the new interactive grid
I don't think I'd remove rows from the interactive report (but OK, that's just me, and my ideas usually aren't too smart).
I have a drop down select list (P2_ROLE). I want to generate the interactive grid based on the value that I select from the drop down.
I am trying to do that but the query is not returning any result in the grid. However, if I query it in the database, it returns me the result.
It looks like that it is not substituting the value from the dropdown into the IG query. But If I hard code the value, it gives me the results.
dropdown_IG issue
I also tried returning the value selected from the dropdown in the item : P2_SELECT_LIST_VALUE and then using it in the query. But it also doesn't work.
The query that I have used for my Interactive grid is :
Select USER_NAME
From WF_USER_ROLES
Where ROLE_NAME = :P2_SELECT_LIST_VALUE ; --using the value from new item
or
Select USER_NAME
From WF_USER_ROLES
Where ROLE_NAME = :P2_ROLE; -- using the value directly from Dropdown
After selecting the value in the dropdown, I am refreshing the IG region using dynamic action on change select list. But that also doesn't help. How can I do that ?
Select list returns two values: display and return. Its form is, for example,
select dname disp_val,
deptno ret_val
from dept;
Its return value is then used in interactive grid's query.
Also, in order to be able to use select list's value, it has to be stored in session state; if it is not, query won't work. The simplest option is to submit the page, and you can do that by setting that item's Page action on selection property to "Submit page". Doing so, your IG query:
Select USER_NAME
From WF_USER_ROLES
Where ROLE_NAME = :P2_ROLE
should work OK. If it still does not, create an example on apex.oracle.com, provide credentials so that we could have a look at what you did.
I have a field in the database that contains date and time - DATE type in the database. When I run the query in Toad, I can see data and time, but when I pull up the data in the APEX report, only date shows up, no time. How can I ensure the time comes up as well?
You can set "Format Mask" column attribute in the Page Designer.
Go to Page Designer, find your report region, open list of columns, find your column and set "Format Mask" e.g. to yyyy-mm-dd hh24:mi:ss.
Another option is to change the SQL query used for the report, make explicit conversion to_char for the desired column.
Oracle Apex 4.2
Oracle 11g
Below is some SQL that generates an interactive report.
I have 2 pages items both are date pickers named :P55_STARTD and P55_ENDD.
I've also have a button to fire a refresh on all the report region. But still get nothing. I thing this is some type of session issue. Any ideas guys.
Select * from
(SELECT REPORT_MISSED_ORDERS_ALL.CUSTOMER_REF,
REPORT_MISSED_ORDERS_ALL.LINE_NO,
REPORT_MISSED_ORDERS_ALL.SKU,
REPORT_MISSED_ORDERS_ALL.PICK_FROM,
REPORT_MISSED_ORDERS_ALL.ORDERED_BY,
REPORT_MISSED_ORDERS_ALL.HR,
REPORT_MISSED_ORDERS_ALL.ORDER_PLACED_DATE,
TO_CHAR(REPORT_MISSED_ORDERS_ALL.ORDER_PLACED_DATE, 'MONTH') AS months,
LOGI_ORDERS.AUTH_TYPE_ID
FROM REPORT_MISSED_ORDERS_ALL
LEFT JOIN LOGI_ORDERS
ON REPORT_MISSED_ORDERS_ALL.CUSTOMER_REF = LOGI_ORDERS.CALLNUMBER
AND REPORT_MISSED_ORDERS_ALL.LINE_NO = LOGI_ORDERS.LINE_NUMBER)t1
where T1.AUTH_TYPE_ID is null
and trunc(t1.ORDER_PLACED_DATE) between :P55_STARTD and :P55_ENDD ;
Have you put date items in "Page items to submit" field?