ArrayFormula Only Populating When Not Empty - if-statement

I have the following formula =ARRAY_CONSTRAIN(ARRAYFORMULA(IF(ARTIST_FILTER_MENU="", TRUE, IF(ARTIST_FILTER_MENU=Data!B2:B, TRUE, false))), COUNTA(Data!B2:B), 1) that will populate TRUE/FALSE values depending on whether data matches a selection in a dropdown menu. And if the dropdown menu is empty, the Boolean result defaults to TRUE.
When the dropdown menu is not empty, the formula works fine, but when it is empty, only the first row is populated.
No dropdown option selected (expected output):
T
T
T
T
T
No dropdown option selected (actual output):
T
After struggling with it for a bit, I figured out it had to do with the line ARTIST_FILTER_MENU="" where I haven't used the A#:A format that is usually required for the ArrayFormula function. I found a temporary solution by checking against a random empty cell range instead of "", or is there a better way that I should go about this?

try:
=ARRAY_CONSTRAIN(ARRAYFORMULA(
IF(ARTIST_FILTER_MENU="", TRUE&IFERROR(Data!B2:B/0),
IF(ARTIST_FILTER_MENU=Data!B2:B, TRUE&"", FALSE&""))), COUNTA(Data!B2:B), 1)
=QUERY({TRACK_NAME_HELPER_RNG, RELEASES_DATA_RNG, RELEASES_HELPER_RNG}, Helpers!$A$11&
" WHERE Col1 IS NOT NULL
AND Col"&Helpers!$B$3&" = 'TRUE'
AND Col"&Helpers!$B$5&" = 'TRUE'", 1)

Related

Remove value from popup lov once its selected

I'm trying to create lov in which once the machine is started it should not show in popup lov after submit.
Popup lov sql is as below:
select machineid,machinenm from machinemaster where idlemachine = 'Y';
but the issue is once machine is status change and this query not finding result for the perticular machineid so in lov it shows blank.
Please suggest any workaroud.
First of all, query you posted looks wrong. Generally speaking, list of values' query returns two values in the following order:
display value
return value
We usually display names and return IDs, which means that you'd probably want to use
select machinenm as display_value,
machineid as return_value
from machinemaster
where idlemachine = 'Y';
the issue is once machine is status change ...
How is that statement reflected in query you posted? There's no "status" column nor "change" status itself; where clause says where idlemachine = 'Y' - no status, no "change".
... and this query not finding result for the perticular machineid so in lov it shows blank
I believe that you should set the Display extra values property ON. Help says:
An item may have a session state value which does not occur in the given list of values definition. Select whether this list of values displays this extra session state value. If you choose to not display this extra session state value and there is no matching value in the list of values definition, the first value in the list of values is the selected and displayed value.
If you're seeing the NULL value, it means that you actually set
display extra values to OFF
display null value to ON

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

Oracle APEX - automatically select a single item in a cascading popup LOV

I have two cascading popup LOVs on my page P2_LOV1 and P2_LOV2
P2_LOV2 gets populated based on a query and the value selected in P2_LOV1. What I want is if there is only one value populated in P2_LOV2, set it as a selected value. How can I do that?
You could create an on change dynamic action with a client side condition of
$('#P2_LOV2 option').length == 2
The length may be 1 or 2, depending on if you have a null option.
If true, set the value. Again, the numeric may be 1 or 0, depending on null selection.
('#P2_LOV2').prop('selectedIndex', 1)
But if you don't have a null selection, this would automatically set to first value, right?

How do I select no items with an updateSelectinput in shiny?

I have a selectizeInput and some action links to make it easier to select certain subgroups. I'd like to have one action link which deselects all values (to make it easier to choose just one item for example -- deselect them all and then the user picks one). The code:
updateSelectizeInput(session, "selectizeList", selected = NULL)
doesn't work, which is by design as the help for updateSelectizeInput (http://shiny.rstudio.com/reference/shiny/latest/updateSelectInput.html) states:
Any arguments with NULL values will be ignored; they will not result
in any changes to the input object on the client.
Given that this is a feature, how can I unselect all values?
I did
updateSelectInput(session, "selectizeList", selected = '')
and it seems to be working for me
Try the following:
updateSelectInput(session, "selectizeList", selected = .)