JoshG

Run if part of list

5 posts in this topic

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



Use a Array and _ArraySearch.

Share this post


Link to post
Share on other sites

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

@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)

 

1 person likes this

When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

that worked thanks for the help

If Not @error Then

If Not @error Then
;run code
else
;dont run code
endif

 

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