Oracle APEX - Initializing an Interactive Grid Column Using PL/SQL - oracle

I have an interactive grid in Apex that I'm trying to add a column that would have its values filled out using PL/SQL. I've added a column to the IG manually by right clicking on it in the page designer and clicking "Create Column". The issue I'm getting is I'm not seeing a way to have column initialized with the output of PL/SQL when I load the page. It seems like under the "Source" section after creating the column, there's only an option for using just SQL.
I've tried looking into dynamic actions for this, but I'm not seeing a way to set all the values in the column to a PL/SQL output when using the "Page Load" event. It seems like doing calculations on each row of a column is pretty straightforward using JavaScript, but I'm trying to port over numerous PL/SQL calculations into Apex so it would be preferable to do this without having to rewrite those scripts.
Is there a straightforward method to do this in Apex?

Related

Select row value from column in interactive report

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

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 Apex return specific values from PL/SQL into a item

I'm using apex 4.0 and I've currently got a SQL query that looks up a table information with SUM and includes simple math with a case statement that display OK if it tallies up or NOT okay if it doesn't in a separate row,
In apex if I use PL/SQL can I return the values specific values specifically the OK to an ITEM in apex to be used elsewhere? I've searched and cannot find anything exact likely because I'm currently ensure on the correct term.
If you have a page item called P123_FOO then you can do this in a page process:
select <whatever>
into :P123_FOO
from <whatever>;
The usual exceptions will be raised if the query returns no rows or more than one.

Export results of a query to a set of INSERT statements?

In Oracle I have the requirement to produce a set of INSERT statements using the results of a SELECT statement. Basically the same way that Toad for Oracle will export the contents of a table to a set of Insert Statements either in a file or on the clip board. Is this possible?
The reason for this is that some of my geometric data is in WGS84 format and when I access it it needs to be British National Grid. This is not a problem in Oracle as I can simply use SDO_CS.Transform(date, srid) however in SQL Server this is not possible. My intention is to produce the INSERTS in Toad and them run them on SQL Server in order to populate the geometry column with the pre-transformed data. This means applying the transform in Oracle during the SELECT.
I don't quite understand how you're trying to export the data from TOAD. But it should work as follows:
Run your SELECT statement in a TOAD editor window.
Press the right mouse button in the data grid with the result and select "Export dataset...".
Choose "Insert Statements" from the first drop down.
Click OK.

Update Apex Tabular form with PLSQL

How can I update an Apex Tabular Form with pl/sql instead of using a multi-row update(MRU), is it even possible?
Thanks in advance.
Yes, it is possible. You can delete (or disable) the standard processes such as ApplyMRU, and replace them with your own PL/SQL processes to handle the tabular form arrays something like this:
for i in 1..apex_application.g_f02.count loop
update dept
set dname = apex_application.g_f03(i)
where deptno = apex_application.g_f02(i);
end loop;
However, it isn't simple and there is a fair bit you need to know to get this right, such as:
How the tabular form columns map to arrays like apex_application.g_f03 (view the page source and look for the names of the controls, e.g. "f03_0001").
How some item types like checkboxes a work differently to others
How to perform optimistic locking to prevent lost updates
There used to be a "how to" document on apex.oracle.com that described this in detail, but I haven't been able to locate it recently.

Resources