Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Including wildcard characters in IF statement
Topic Summary: Method to include wildcard characters in a standard IF statement
Created On: 03/25/2011 10:22 AM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by BillRishsew, on Monday, April 4, 2011 8:47 AM

Answer:

OK, here is what I did:

If ((StrComp(strFilename, Left(fileList.FTPFileName, 21), 1) = 0) AND (bolSuccess <> 1))

I know what the first 21 characters of the file to download will be each day. The hhmmss would be a shot in the dark.

So, by grabbing each file in the FTP list and performing a string comparison on the first 21 characters, the file is located and downloaded.

Thanks for the direction.

 

 03/25/2011 10:22 AM
User is offline View Users Profile Print this message

Author Icon
BillRishsew
Student (5-19 posts)

Posts: 9
Joined: 03/24/2011

I've spent the hour reading through several post pertaining to using wildcards in standard IF statements.

Didn't find anything useful. May be I'm not getting the concept yet. I'm in my second full day of using this application, so a little slack is appreciated.

I have a file I need to download each day. It is in the format Filename_20110325071039.csv (yyyyddmmhhmmss). There is nothing I can do about the name. There is no way to anticipate the hhmmss, obviously, so I included ?????? in the variable that builds the filename.

No bueno.

The IF statement finds itself in a LOOP. The LOOP looks at a long file list of the FTP directory contents. I see the file go by when running in debug mode. So I know the file is there. I also see the variable displayed as Filename_20110325??????.csv.

So, basically the IF statement looks like something like this:
   If %variable1% = %fileList.fileName% then...



 Category Survey
 03/25/2011 11:16 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Bill,
unfortunately, IF's do not accept wildcards.
You would have to do a complex IF for instance
IF %left(variable1,17)=left(filelist.filename,17) AND right(filelist.filename,4)=".csv"%

 Category Survey
AutoMate 7 version:
Windows version:


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 03/25/2011 01:01 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Bill,
I answered too fast.
A possibility exists using the "like" operator in the expression in the IF
IF %filelist.filename LIKE variable1% then

The LIKE compares with wildcards in the second term

 Category Survey
AutoMate 7 version:
Windows version:


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 04/04/2011 08:47 AM
User is offline View Users Profile Print this message

Author Icon
BillRishsew
Student (5-19 posts)

Posts: 9
Joined: 03/24/2011

Answer Answer

OK, here is what I did:

If ((StrComp(strFilename, Left(fileList.FTPFileName, 21), 1) = 0) AND (bolSuccess <> 1))

I know what the first 21 characters of the file to download will be each day. The hhmmss would be a shot in the dark.

So, by grabbing each file in the FTP list and performing a string comparison on the first 21 characters, the file is located and downloaded.

Thanks for the direction.

 



 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)
 04/04/2011 09:41 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

You're welcome, Bill.
Your solution with StrComp is also quite nice.

 Category Survey
AutoMate 7 version:
Windows version:


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 10/03/2012 01:37 PM
User is offline View Users Profile Print this message

Author Icon
MarcVerner
n00b (>6 posts)

Posts: 1
Joined: 10/03/2012

Very useful thread - helped me out of a jam today.   Thanks Jean and Bill.



 Category Survey
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 2019 guests browsing this forum, which makes a total of 2019 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2020 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog