Oracle Apex Get Set Variable from datepicker - oracle

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?

Related

Make Specific rows not editable using Interactive Report

I am using Apex 18.2. I created an interactive report which has 10 records. I try to add a logic that user can only be able to edit those records which recently created. User cannot do an edit to an old records. Means when user try to edit old records, it show as 'Display only' or not editable. Is there any way I can do that? Your help is really appreciated. Thanks
One option is to create your own link (icon, if you wish), just like another column in report's query.
As you're in SQL now, use any condition you want. Obviously, you have to be able to distinguish "old" from "new" rows. If we suppose that it is some DATE datatype column, so whatever is "yesterday" or older is considered to be "old", you'd
select case when datum < trunc(sysdate) then null
else 'Click here'
end as link,
empno,
ename
from emp
LINK column's type would be "link" (of course) and you'd make it navigate to another page in this application, pass values from here to there, etc.

Date Picker Parameter for Oracle Apex Interactive Report

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;

Crystal Reports displays blank (null) values for some fields from an Oracle view

Summary
We have a Crystal Report referencing a single Oracle view. There are no other tables or joins in the report. The view is composed of several selects, joins, and other data transformations (e.g., sum, case, to_date, group by).
Four columns from the view display as blank (null) in the report. These same columns display correctly in Oracle SQL Developer and via a select using the Oracle Data Provider for .NET in a C# application. All other columns display correctly in the report.
In addition the Browse Field option displays no values for the affected fields, but does display options for unaffected fields of the same type. Similarly, if I make an affected field a parameter of the report no options are presented.
We verified that in all cases we are connecting as the same read only user in Crystal Reports, Oracle SQL Developer, and in our Web Application.
Failed Resolution Attempts
We removed and replaced the view and fields in the Crystal Report.
We created a brand new report connecting to the same view.
We created a new view (from the same SQL) to be used in the same report
We verified database via Crystal Reports
We converted implicit date conversion from
score_month = '01-SEP-2017'
to
score_month = TO_DATE('01-SEP-2017', 'dd-MON-yyyy')`
per https://stackoverflow.com/a/37729175/19977
Other Oddities
Exporting the data from the view to a table works, but we want to use a view
We're at a loss as to what the cause of this issue is. Any ideas?
Several edits to the view were required to resolve this issue.
We removed Oracle specific sql per https://stackoverflow.com/a/37729175/19977. Example:
-- replace
TRUNC(sysdate, 'MONTH') AS score_month`
-- with
TO_DATE('01-SEP-2017', 'dd-MON-yyyy')
-- and replace
where score_month = '01-SEP-2017'
-- with
where score_month = TO_DATE('01-SEP-2017', 'dd-MON-yyyy')
Fully qualify all tables and views used in the Oracle view with the schema and table name. Example:
-- replace
FROM table t
-- with
FROM our_schema.table t
It remains unclear why the view would work as intended from Oracle SQL Developer and in application via the Oracle Data Provider for .NET but not from Crystal Reports. Further insight into this issue is welcome.

Oracle / SQL Developer displaying (null) in column

I have any oracle table that sometimes has valid null values is some cells. In SQL Developer it displays in the null cell as (null). This is not a problem but in a grid I have on a jsp page is also displays as (null) and I need it just to be blank. NVL does not work unless I use a space. I was wondering if there is an oracle setting or something to have valid null cells just be blank ? thank you
Modifying SQL Developer Preferences
Jeff Smith, the product manager for SQL Developer, blogged about this here, http://www.thatjeffsmith.com.
Just navigate to the SQL Developer tool bar as follows:
Preferences>Database>Advanced
and change the value in the field, "Display Null Value As", to nothing as seen here:
~~~~~~~~~~~~~~~~~~~~~~~~~~
With a jsp, one could create a method for scenarios where a column is null (to display the null as other than '(null)').

Strange results with in Oracle Apex using Pivot showing nulls and n

Im running a oracle 11g with Apex 4.2.6. Im trying to run a script but giving back nulls in apex but showing correct results in SQL developer
select "ENG_ID","ENG_ID1","roles","Region","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15" ,"16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31" from (
select M.ENG_ID as ENG_ID,
M.ENG_ID as ENG_ID1,
e.ROLE_ID as "roles",
e.REGION_AREA_ID as "Region",
EXTRACT(DAY FROM M.MS_DATE) as DOM,
MD.MD_ID
--MD.JOB_TYPE_ID
from MD_TS_DETAIL MD,
MD_TS_MAST M,MAN_ENGINEERS e
where
m.eng_id = 542 and
M.ENG_ID = e.ENG_ID and
M.MAST_ID=MD.MD_ID and
M.MS_DATE between trunc(sysdate,'MM') and last_day(sysdate)
)pivot (
max(MD_ID)
for DOM in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31)
)
which gives me the correct result of
SQL Dev view
Yet running the same script within Apex you get nulls.
apex view.
I'm completely stumped do you guys have any ideas
Ok after checking what the max records where both records where both on APEX and the database directly.
. In SQL workshop > selected MD_TS_MAST > statistics > analyse > estimate statistics change to 100% > next >finish.
all records came back. Why apex did not run from the database directly I don't know. So basicily if doing inserts in SQL developer, You must do a update via analyse.

Resources