Refresh Select List - oracle-apex

I have two Select Lists, first one contains data from database (names, ids; P19_FIRST), second one must contain another list of data (names; P19_SECOND) by data from first select list. I create dynamic action (change event) which one must update second select list by data from first one, but this does not happens. When I choose element from first select list, dynamic action must set value with SQL statement for second list (P19_SECOND):
select distinct name d, id r
from function
where function.company_id = :P19_FIRST
order by id
If I trying same code for Display Only instead of Select List, it works, but shows only names, without ids. By default (List of Values) for item P19_SECOND query is same and it works correctly (value is id and option name is name). What I doing wrong?

Related

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.

oracle apex 20 - cascading list of values does not work e.g. checkbox groups

I added 2 checkbox groups (:P1_G1, :P1_G2) to a Static Content region
I specified the List of Values ​​SQL queries
select r, d from code where parent is null
select r, d from code where instr (',' || parent || ',', ',' ||:P1_G1 || ',')> 0
I set the Cascading List of Values ​​Parent Items (s)
:P1_G2 -> :P1_G1
If changed :P1_G1, :P1_G2 does not change.
The List of Values ​​in :P1_G2 does not see the value of :P1_G1, because it has not been updated on the server side.
I could only solve the problem by adding a new item (:P1_G1_ACT), which I added a value to with a dynamic action, and running a "dummy" pl / sql code (x:=1;) and then :P1_G2 List of Values in select in query replace :P1_G1 to :P1_G1_ACT.
Does anyone have a better solution, an idea?
Thanks
In the Cascading List of Values you need to specify the items that are used in the SQL in the "Items for submit" field.
This means that if there is a change in the parent item, all the values of the necessary items are sent to the server side

How to create a field with a list of choices but store the index?

I'm making a Microsoft Access table where one of the fields is a list of pre-made options. When I make a SQL query on that table it returns the values of the list as strings containing the spelled out choice. I would like to assign numerical values to each element of the list so a SQL query returns a number instead. How do I do this? I know it's possible because I have an access file with such a list but I'm unable to recreate it.
An easy way to do this is to have your combo box use a query of the table as a Rowsource. This query would have the table unique ID in the first field and the field you wish to return as the second field. Then change the setting on the combo box for "Column Count" to 2. If you want to show both fields change the "Column Widths" value to 1"; 1". If you want to show only one field, change the value of one you do not want to see to 0. Now we you refer to this list in an SQL queries, it will use the ID field but show the user the string field.

How do i can create IR in apex oracle based on different table and column

IR based on PL/SQL Function Body returning SQL Query.
How do i can create Interactive reports based on multiple table and Deferent column name.
Exp :-
Select list item return three value
1 or 2 or 3
And the function return query basen on select list value
when Value equal 1
Select name, satate, country_id from cities
when value equal 2 Return
Select country, id from country
when value equal 3 Return
Select ocean,oc_id,from oceans
The three query return different column name and value.
Ok firstly, your question is poorly written. But from what I gather, you want an SQL query that returns different things based on an input.
I dont think you even need a plsql function body for this.
Simply do something like this:
SELECT * FROM
(SELECT name as name,
state as state,
country_id as id,
1 as value
FROM cities
UNION ALL
SELECT country as name,
NULL as state,
id as id,
2 as value
FROM country
UNION ALL
SELECT ocean as name,
NULL as state,
oc_id as id,
3 as value
FROM oceans)
WHERE value = :input_parameter_value;
Because if you are trying to display a variable number of columns and constantly changing their names and such. You are gonna have a bad time, it can be done, as can everything. But afaik its not exactly simple
No objections to what #TineO has said in their answer, I'd probably do it that way.
Though, yet another option: if your Apex version allows it, you can create three Interactive Report regions on the same page, each selecting values from its own table, keeping its own column labels.
Then create a server condition for each region; its type would be Function that returns a Boolean and look like
return :P1_LIST_ITEM = 1;
for the 1st region; = 2 for the 2nd and = 3 for the 3rd.
When you run the page, nothing would be displayed as P1_LIST_ITEM has no value. Once you set it, one of conditions would be met and appropriate region would be displayed.

Sitecore Name Lookup Value List - Multilpe Values per Key

Specifically in sitecore, the column configuration is defined using a Name Lookup Value List, and I want to add a colour drop down along side it so it can be applied specifically to each column as set up by the configuration. This means for each key (column ID) I want the column config as a drop down and the colour as a drop down.
If you don't want to create a custom field that will allow to do this, you should:
Create Column Specification template
Add 2 fields to this template: Column and Colour
Create items using this new template for every column you need
Instead of selecting columns in your Name Lookup Value List, select Column Specification items.