how to get an item "Database column" name - oracle-apex

Oracle Apex 19.1.0.00.15.
how to get an item "Database column" name for IG or Form region like that exists in Oracle Forms
get_item_property('block.item',COLUMN_NAME);

I don't know of an existing function to do this, but you can obtain it like this for a form item:
select item_source
into v_column_name
from apex_application_page_items
where application_id = :APP_ID
and item_name = v_item_name;
You could wrap that in a function of your own.
There is another APEX view APEX_APPL_PAGE_IG_COLUMNS for IG columns, but I can't see how you would need that as to look up the column name you are going to need to know the column name, right?!

Related

Get Select list Item value in IG report column for DML operation

I have a Select list filter on the top of the page. I want its return value to get into any column which I create in IG report automatic DML process.
Suppose, Select list has a value "Step", when I add a row in IG report, that value should be saved into DB for one column which is hidden on UI.
I tried but sometimes it stores the value which I selected in Select list item as my last selection not the current one. Do I need to create Application item for this? Please help. TIA
In this case there is a table ig_tickes with a status column. On the page there is a page item P131_STATUS (select list) with values "OPEN" and "CLOSED". There is an interactive grid on table ig_tickets with column STATUS hidden. Functionality is that user selects a value from the select list and then clicks "Add Row".
Give the interactive grid a static id of "tickets"
Create a dynamic action on change of P131_STATUS with a true action of type "execute javascript code" and code:
var model = apex.region("tickets").call("getViews").grid.model;
model.getOption("fields").STATUS.defaultValue = apex.item( "P131_STATUS" ).getValue();
That's all there is to it.

Creating Dynamic LOVs

I have a form in oracle apex with more than seven items on it. they are
SUBJECT_ID,GRADE_ID,DOMAIN_ID, CATEGORY_ID, STANDARD_CODE, STANADARD_STATEMENT, LEARNING_TARGETS.
I want these items SUBJECT_ID,GRADE_ID,DOMAIN_ID, CATEGORY_ID, STANDARD_CODE type to be select list. additionally, I want to make LOVs for each of these items.
LOV for SUBJECT_ID: I am making this LOV using a table SUBJECTS having TWO columns. MY query is SELECT SUBJECT_ID, SUBJECT_NAME FROM SUBJECTS It's working fine.
LOV for GRADE_ID: I am making this LOV using a table GRADES having TWO columns. MY query is SELECT GRADE_ID, GRADE_NAME FROM GRADES It's working fine.
LOV for DOMAIN_ID: I am making this LOV using a table DOMAIN having TRHEE columns. MY query is SELECT DOMAIN_ID, DOMAIN_NAME FROM DOMAIN WHERE SUBJECT=:P48_SUBJECT_ID. It's working fine.
LOV for CATEGORY_ID: I am making this LOV using a table CATEGORIES having FOUR columns. MY query is SELECT CATEGORY_ID, CATEGORY_NAME FROM CATEGORIES WHERE DOMAIN=:P4.8_DOMAIN_ID It's working fine.
LOV for STANDARD_CODE: I am making this LOV using a table CURRICULUM having MORE THAN EIGHT columns. MY query is SELECT CURRICULUM_ID CI, STANDARD_CODE SC FROM CURRICULUM WHERE SUBJECT=:P48_SUBJECT_ID AND GRADE_ID=:P48_GRADE_ID AND DOMAIN_ID=:P48_DOMAIN_ID AND CATEGORY_ID=:P48_CATEGORY_ID. It's not working for me.
Kindly tell me how I can correct the 5th LOV. Thanks
I wouldn't say that any of LoV queries you posted return desired result and "work fine". Their format should be:
select display_value, --> you see it on the screen
return_value --> you don't see it; it is stored into the table
from ...
Code you posted suggest just the opposite, e.g.
SELECT SUBJECT_ID, --> are you REALLY displaying ID to users and
SUBJECT_NAME --> storing NAME into the table?
FROM SUBJECTS
As of your final LoV: just as MT0 commented, we have no idea what "not working" means. You posted a whole lot of more or less useless information (queries that "work"; what should we do with them?), but said nothing about problem you have.
Therefore, I'll guess: you forgot to include
P48_SUBJECT_ID, P48_GRADE_ID, P48_DOMAIN_ID, P48_CATEGORY_ID
into the Parent Item(s) property within the "Cascading List of Values" section, e.g.
Note that query you posted presumes that all page items have a value; if any of these is NULL, query won't return anything so that would be my second guess:
SELECT curriculum_id ci, standard_code sc
FROM curriculum
WHERE ( subject = :P48_SUBJECT_ID
OR :P48_SUBJECT_ID IS NULL)
AND ( grade_id = :P48_GRADE_ID
OR :P48_GRADE_ID IS NULL)
AND ( domain_id = :P48_DOMAIN_ID
OR :P48_DOMAIN_ID IS NULL)
AND ( category_id = :P48_CATEGORY_ID
OR :P48_CATEGORY_ID IS NULL)
In that case, switch the "Parent required" property OFF.

Is there any way to get the displayed text in the "Select List" without using SQL? (Oracle APEX 21.1)

Anyone help me?
"Select List" (name: P2_SHOPS_LIST) that is created with the following SQL
SQL Statement: SELECT SHOP_NAME, GROUP_ID FROM T_ENTRY_SHOPS WHERE ID=:P2_LOV_ID;
It is necessary "GROUP_ID" because it is PK . But I need edit "SHOP_NAME" value and display to Text Field.
I think I can get the currently displayed SHOP_NAME by combining the above SQL with the selection row number, but is there any way to access this value with No SQL? Like
:P2_SHOPS_LIST.SHOP_NAME
(This gave me an error XD).
In the context of JavaScript, you can use the following
$('#P2_SHOPS_LIST option:selected').text()
This can be passed through to PL/SQL via a dynamic action, such as on change of your select list.
Or you could set your text item on change via a JS based action, using 'Set Value' and that code as the expression.

Refresh Apex 5.0 chart results with different dynamic actions on same SQL query

I have created a bar chart on APEX 5.0 where my query looks like below:
select col1 as label,col2 as value from table1 where :P3_NEW_1 = col3;
here: P3_NEW_1 the page item I have created of type "Select List".
The list of values in "Select List" page item are pre-populated in the dropdown using the "Shared component" type I have created and so far this worked fine and I am able to display the results of above query by passing the value through the page item select list.
Now I need to add 2 data pickers on the same Apex page such that I should now be able to filter the results using date picker through dynamic action.
I know that using an additional button I can create a dynamic action but my problem is how do I modify the above query such that following should happen.
During the page load, once I select a particular value from the "Select List", it should display records based on the value selected from dropdown
This I already achieved using above sql query for the bar chart.
Once the bar char is displayed, I should next be able to filter and display the results using date ranges through date pickers.
Here my problem is my bar chart query is same but I need to now pass the start_date and end_date to the same above sql query which but I am not sure how to achieve this. If I add a button for dynamic action I need to select the report region which is the "bar chart" region and here my query needs modification.
Once the bar chart display the results, at the next step how do I filter the results by having the date filters with dynamic action on the same region where bar chart was displayed. How to achieve this?
You can change the query to something like this:
SELECT COL1 AS LABEL,
COL2 AS VALUE
FROM TABLE1
WHERE :P3_NEW_1 = COL3
AND (:P3_START_DATE IS NULL
OR TO_DATE(TIME_STAMP,'YYYY-MM-DD-HH24:MI:SS') BETWEEN :P3_START_DATE AND NVL(:P3_END_DATE,SYSDATE));
Where :P3_Start_date and :P3_End_date are the Start and End date pickers and TIME_STAMP is your column where you store the date.
After modifying the query you can simply add a button where at Behavior>Action select Submit Page.
This way when you click the button, the page will be submitted and chart refreshed.
If you want to take your chart to the next level you can do a partial refresh on it. Here is a short video tutorial of partial refresh on a report but you can apply the same login on your chart.

Fail to query a list corresponding another value in ADD ROW action

Please Help...
I am using Oracle Apex.
I created the FORM page with Master Details form, it has CW_ORDER and CW_SALESLINE table. There also is a CW_INVENTORY table.
When user press "Add Row" button, there will show two list boxes for choosing which 'TYPE' as Product type" and 'INV_ID' as Product Description".
TYPE as Product Type is configured "Select List(static LOV)"
with List of Value (STATIC:Hardware;Hardware,Software;Software)
User can choose 'Hardware' or 'Software' only.
INV_ID as Product Description is configured "Select List(query based LOV)
with List of Value (select description, inv_id from cw_inventory where cw_inventory.type = :type)
I want that when user chooses Product Type value such as 'Hardware' and then Product Description can list only the type of Hardware items for choosing instead of all items are listed.
In CW_Inventoty has a 'TYPE' column, its value is Hardware or Software.
I think the (select description, inv_id from cw_inventory where cw_inventory.type = :type) something wrong.
Please advise. Thank you so much .....
To achieve your above requirement,
you want to use cascading select list concept here in tabular form.
refer Cascading select list on tabular form for more details.