Jump to content
JoshG

Run if part of list

Recommended Posts

JoshG

I need to run a program based on a list of #'s if the query shows its is in the list it should run.

i.e.

list of #s

[1122, 5337, 5339, 5440]

if $storeNum is( in above list/array)  continue 

if not exit...

my other option would be to list all of my possible stores#'s with a yes no flag
 

[1122, yes
1130,no
5337,yes
5338,no
5339,yes
5440,yes]

Any ideas how i can create the query that will result in positive if it sees the# and false if it does not?  basically do an excel countif..

 

Thanks in advance for any and all help

 

Share this post


Link to post
Share on other sites
AutoBert

Use a Array and _ArraySearch.

Share this post


Link to post
Share on other sites
JoshG

can i just use the error codes on a search?  I just want to see if a # is in my array and if so true if not false?

Share this post


Link to post
Share on other sites
JLogan3o13

@JoshG you probably could have tested this out yourself faster than you wrote the question...

#include <Array.au3>

Local $aNum[6] = [1122, 1130, 5337, 5338, 5339, 5440]

    _ArraySearch($aNum, 5338)
    ConsoleWrite(((@error) ? "Not Present" : "Present") & @CRLF)

 

  • Like 1

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.