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!

JavaScript equivalent of SQL in

raoulOct 17 2013 — edited Oct 17 2013

Hi all,

I do not know where to ask this question, but I am trying to write a javasctript for my dynamic action.

Now I have to check a variable for values and I do it like this:

if ($v("APEX_ITEM") == 1 && $v("APEX_ITEM")==2) { ....}

In SQL I would write:

apex_item in (1,2)

Is there something like that for Javascript because I have a list of ten id's.

Thank you.

Raoul

This post has been answered by anai on Oct 17 2013
Jump to Answer

Comments

anai
Answer

You could use indexOf, but that doesn't work in IE.

Try this:

var list = [ "1", "2", "3", "4"];

alert(jQuery.inArray( "3", list ));  //this will return 2

alert(jQuery.inArray( "5", list )); //this will return -1

If the element is not in list, inArray will return -1. So basically, you need to check if the returned value is -1 (the element is not in list) or greater (the element is in list).

Marked as Answer by raoul · Sep 27 2020
1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 14 2013
Added on Oct 17 2013
1 comment
650 views