Press "Enter" to skip to content

Oracle Apex Client-side Condition JavaScript Expression Example

In Oracle Apex, we use client-side conditions with dynamic actions to perform a particular action if the client-side condition met and perform another action if the client-side condition does not match. And if your condition depends on multiple items, then you have to use JavaScript Expression type client-side condition. In this tutorial, I am giving some examples of it:

Client-side Condition JavaScript Expression Examples

To specify the client-side condition for your dynamic action, click on the dynamic action of your item, and then select its type to JavaScript Expression for the client-side condition, as shown in the below image:

Oracle Apex client-side condition JavaScript expression.

Usually, for the client-side condition, we require to compare multiple items with a specific value. The following is an example to compare various items using apex.item.getValue() method with JavaScript expression. The True type of dynamic action will execute if the employee status is active, and the employee department is equal to 30:

(apex.item('P2_EMP_STATUS').getValue() === 'ACTIVE' &&
   apex.item('P2_DEPT').getValue() === 30)

If this client-side condition does not match then the False type of dynamic action will execute.

Below is another example to check if the field first name is null or the last name is null:

(apex.item('P2_FIRST_NAME').isEmpty() || 
apex.item('P2_LAST_NAME').isEmpty())

And the following example having both AND and OR conditions:

(apex.item('P2_EMP_STATUS').getValue() == 'ACTIVE' &&
   apex.item('P2_DEPT').getValue() == 30 || 
   apex.item('P2_EMP_DESIG').getValue() == 'ADMINISTRATOR')

Related Tutorial:

Have you found the answer to your question? If not, you can discuss it with me in the comments section below or join my Q&A community OrclQA.com for developers and ask your question. It is FREE.

Vinish Kapoor

Follow

Hi, I am a full stack developer and writing about development. I document everything I learn and help thousands of people. foxinfotech.in is created, written, and maintained by me; it is built on WordPress, and hosted by Bluehost. Connect with me on Facebook, Twitter, GitHub, and get notifications for new posts.

guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
VARSHA
VARSHA
1 day ago

Hi Vinish
can’t we do it with IG columns