![]() |
![]() |
We are currently migrating this forum over to our HelpSystems domain. Please post all new threads in our new HelpSystems Community Portal. |
![]() |
|
![]() |
AutoMate Discussion | ![]() |
help :
faq :
home
|
||
Latest News:
|
latest topics : statistics |
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 |
![]() |
![]()
|
![]() 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.
| ||||||||||
![]() |
||||||||||
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:
|
||||||||||
|
||||||||||
![]() |
||||||||||
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"%
------------------------- Jean Delfosse - Automate Beta Tester Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4 ![]() |
||||||||||
|
||||||||||
![]() |
||||||||||
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
------------------------- Jean Delfosse - Automate Beta Tester Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4 ![]() |
||||||||||
|
||||||||||
![]() |
||||||||||
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.
Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder) |
||||||||||
|
||||||||||
![]() |
||||||||||
You're welcome, Bill.
Your solution with StrComp is also quite nice.
------------------------- Jean Delfosse - Automate Beta Tester Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4 ![]() |
||||||||||
|
||||||||||
![]() |
||||||||||
Very useful thread - helped me out of a jam today. Thanks Jean and Bill.
|
||||||||||
|
AutoMate Discussion
» AUTOMATE » AutoMate 7
»
Including wildcard characters in IF statement
|
![]() |
FuseTalk Enterprise Edition v4.0 - © 1999-2021 FuseTalk Inc. All rights reserved.