Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How do you make a Checkbox readonly?

Glenda HasleyMay 10 2022

We are on APEX 21.2
On the Form page shown below, the Assignee Completed field is a Checkbox field. The Checked Value is Y and the Unchecked Value is N.
The Maintains Session State is ‘Pay Session (Disk)’
image.pngWhen the user changes the Assignee Completed Field from N to Y, a dynamic action is triggered.
image.pngThis dynamic action triggers an alert and several Set Values to set the values in the yellow highlighted fields (see below) and Execute JavaScript Codes to make those fields and the Assignee Complete checkbox to readonly.
image.png
The Execute JavaScript Code (highlighted above in green) contains the following.
All the true actions in this dynamic action work, except for this one.
How do I make the Assignee Completed field readonly after changing the assignee complete from N to Y?
image.pngimage.pngimage.png

Comments

Frank Kulash
Hi,

Assuming the columns bb, cl and la are never NULL:
SELECT	customer_key
,	GREATEST ( bb
		 , cl
		 , la
		 )	AS spend
FROM	TABLE_X
;
Assuming the numbers can be NULL, is there a lower bound to their possible values (such as 0)?
If so, use NVL to map NULLs to an impossibly low value, e.g. NVL (bb, -1). You may want to use NULLIF to map that back to NULL in the event that all 3 columns are NULL.
If not, unpivot the 3 columns in to one column and use the aggregate MAX function.
Kodiak_Seattle
Cooool, let me try that out, thanks!
Kodiak_Seattle
Ok, this worked, I guess I need one more thing, I need an additional field that will tell me which column the Greatest Spend Came from, like BB, or CL, or LA ?

How would something like that be done ?
Frank Kulash
Answer
Hi,

Use a CASE expression.
Assuming the numbers are distinct and not NULL:
SELECT	customer_key
,	GREATEST ( bb
		 , cl
		 , la
		 )	AS spend
,	CASE
		WHEN  bb >= GREATEST (cl, la)	THEN  'BB'
		WHEN  cl >= la	     	  	THEN  'CL'
		      	    			ELSE  'LA'
	END		AS column_name
FROM	table_x
;
Marked as Answer by Kodiak_Seattle · Sep 27 2020
Kodiak_Seattle
Thank you for your time!
Aketi Jyuuzou
I like simple case expression :D
SELECT customer_key,GREATEST(bb,cl,la) AS spend
CASE GREATEST(bb,cl,la)
when bb then 'BB'
when cl then 'CL'
when la then 'LA' END AS column_name
FROM    table_x;
1 - 6

Post Details

Added on May 10 2022
5 comments
1,722 views