Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Correcting If statement looking for multiple strings
#6
Solved: 10 Years, 9 Months, 1 Week ago
Hi ,
I have tried the same and is working fine

Code:
GroupName = DataTable.GetSheet("Action1").GetParameter("GroupName").ValueByRow(1)

'GroupName="CLIENT DOCUMENTS - WBS"
If not strcomp(GroupName,"CLIENT DOCUMENTS - WBS",1)=0 or strcomp(GroupName, "COMMISSION REPORTS BY SUB / BRANCH / REP",1)=0 or strcomp(GroupName,"BRANCH REPORT SEARCHES",1)=0 or strcomp(GroupName, "SUB-FIRM REPORT SEARCHES",1)=0 or strcomp(GroupName, "FIRM REPORT SEARCHES",1)=0 then

msgbox "no  match"
else
msgbox "match"
end if
Alternatively like anemuday said ,try the below code....
The mistake in your code is string declaration
str=str="CLIENT DOCUMENTS - WBS" or "COMMISSION REPORTS BY SUB / BRANCH / REP" or "BRANCH REPORT SEARCHES" or "SUB-FIRM REPORT SEARCHES" or "FIRM REPORT SEARCHES"
and the correction is
str="CLIENT DOCUMENTS - WBS,COMMISSION REPORTS BY SUB / BRANCH / REP,BRANCH REPORT SEARCHES,SUB-FIRM REPORT SEARCHES,FIRM REPORT SEARCHES"
copy & paste the below code and run its working fine.
Code:
str="CLIENT DOCUMENTS - WBS,COMMISSION REPORTS BY SUB / BRANCH / REP,BRANCH REPORT SEARCHES,SUB-FIRM REPORT SEARCHES,FIRM REPORT SEARCHES"
GroupName="CLIENT DOCUMENTS"
if instr(1,str,GroupName) > 0 then
msgbox  "String exists"
else
msgbox  "String does not exist"
end if
If you still have issues with the code. Please post the error message

Regards,
Ravi
Reply


Messages In This Thread
RE: Correcting If statement looking for multiple strings - by ravi.gajul - 11-03-2011, 11:51 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Wink compare strings and perform action Forrest Gump 4 26,470 09-06-2011, 11:55 AM
Last Post: Rohan
  If statement with multiple conditions mv8167 4 13,255 08-20-2011, 08:34 PM
Last Post: Arul

Forum Jump:


Users browsing this thread: 1 Guest(s)