apex_item_text Add Row/Remove Row Apex - oracle-apex

I am working with Apex_Item_Text .. i am using the below query to display the text area in apex as null initially.
select distinct a.GUID, a.CREATED_BY, a.created_date, apex_item.text(null)
Delete from
NON_DYNAMIC_USER_GROUP_MEMBERS a,
NON_DYNAMIC_USER_GROUPS b
where a.DYNAMIC_GROUP_ID in
(select DYNAMIC_GROUP_ID from NON_DYNAMIC_USER_GROUPS
where instr(','||DYNAMIC_GROUP_ID||',' , ','||:P153_ID_HIDDEN||',') > 0) ;`
In Apex application once the text area filled by user as Delete/Add, it has to update in table when submit button pressed, i don't know how to proceed further on this.
Thanks

You need to pass in a number into the apex_item.text function. By passing a number APEX will automatically create an array that will store the values of those columns.
This can be referenced in your delete statement with: APEX_APPLICATION.G_FXX(i) where XX is the number you pass into the apex_item.text function and i is the index of the item.
Without passing a number into the apex_item.text function I would have no idea how to reference that field
See oracle documentation for more information about apex_item.text: https://docs.oracle.com/cd/E14373_01/apirefs.32/e13369/apex_item.htm#AEAPI211

Related

How reference an IG's column name instead of an array's index?

I am using Oracle APEX 22.1.1.
I have 2 IG's. I am grabbing data from region 1 and inserting it into region 2. I am using "getSelectedRecords[index of the record][index of the column] to grab a specific value i.e a column named "PATIENT_NAME". There will be a problem when columns order changes. For example, the grid has PATIENT_ID which is the first column displayed to the user and PATIENT_NAME which is displayed after PATIENT_ID. If the user changes the order and displayed PATIENT_NAME before PATIENT_ID, the code will grab a wrong value. How to solve that? How to reference the name instead of the index number?
I remember there was an option "recordIsArray" that determines if the model should return an array or an object, but I can not find it anymore, and I do not know how to set it. Is that the way I should use or is there a better way?

How get display value of checkbox in a checkbox group?

I am using APEX 21.1. I have a checkbox group whose list of values is retrieved using a query...
select disease, id from history;
The query returns many checkboxes. I have another textarea item. I need to get the display value for any checkbox whenever it's checked and set item HISTORY to that value. How to do so?
Describing a how-to would be so much easier if you had provided some example page item names and example data. So, lets call your checkbox group P10_CHECKBOX and your textarea P10_TEXT.
Usually, your checkbox group will save the item ids as a colon seperated list, like this: 3:4:5
To display the corresponding display values, make a dynamic action on change on your item P10_CHECKBOX.
Then, use an action of type Execute PL/SQL Code to fetch the display values of your items.
The code could look like this:
select listagg(disease,chr(10)) within group (order by disease) into :P10_TEXT
from history h
join table(apex_string.split_numbers(:P10_CHECKBOX,':')) t on (h.id = t.column_value);
apex_string.split_numbers will convert your colon list into an actual "table" with the column column_value you can use in the join clause. listagg will do the actual concatenation and will work up to a couple thousand characters. chr(10) is an ordinary line break and will have your items be shown line by line, but any other seperator will do.
Last step is to set up P10_CHECKBOX in your Items to submit and P10_TEXT in your Items to return.
Now, whenever you click a checkbox, the textarea will be updated immediately.

Popup LOV with multiple values on Interactive Grid displays APEX 19.2

I'm using Oracle Apex 19.2 and I have an editable interactive grid with a POP LOV.
Multiple Values is checked
Display As is set to Modal Dialog
My List of Values is a SQL Query:
select name as d, id as r from table_x
I have two issues and I don't think I found a good question on SO that solves it:
Although the modal shows the human readable names to select from, once a record is Saved AND there's more than one value selected, the cell is displayed as ID1:ID2:ID3.... instead of NAME1:NAME2:NAME3...
IF the "name" is a string and not a number AND multiple values are selected THEN an "ORA-01722: invalid number" occurs
Note that in both cases, as long as only 1 value is selected there is no issues with saving.
I understand the storing the field with colons however I'm talking about the visible grid for the user. It should not show the user colon separated IDs after save but show the user list of users for example.
For example, here's a list of room numbers (100, 101...) and they correspond to IDs (3, 7 , 4)
I would suspect after I save, the table still shows 100, 101, .. NOT the IDs to the user.
Any thoughts anyone?

storing apex_item.select_list_from_lov selection

I have an LOV in my HTML page that I created with APEX_ITEM.SELECT_LIST_FROM_LOV
Should I also create a Page Item for it?
I mean I am a bit confused because this item has no name as they got if I 'd create an LOV as PAGE ITEM.
How should I get the selected value to insert it for example, into apex_collections?
Thanks in advance
You can get the value of an item created using the APEX_ITEM package by looking at the PL/SQL array apex_application.g_fNN where "NN" is the number you used as the first parameter to the APEX_ITEM function.
For example, if you used APEX_ITEM like this:
apex_item.select_list_from_lov(42, 'MY_LOV')
then you can get the values like this:
for i in 1..apex_application.g_f42.count loop
l_value := apex_application.g_f42(i);
end loop;
(If you had used APEX_ITEM in a multi-row report then there will be more than 1 element in the array.)

Oracle-apex dynamic list of values

I want to make a select list in apex in which when i select any number from select list then it displays diffrent column table for example when i select 1 then it display (bags) when select 2 it displays (trousers)...
I hope I understand your question right.
For a select list you need to create a list of values. There you have to fill two columns, the Display Value Column and the Return Value Column.
Like the label says, the Display Column is for displaying (like trousers, bags) and the return value returns another value (like 2, 1) to the database. On the database it won't be saved as trousers or bags, it will be saved as 2 and 1.
Hope this helped you.