Brett to avoid the false positives, just put some kind of delimiter character between each item. For example here I used the caret ^ symbol:
Original Message:
Sent: 01-16-2025 13:38
From: Brett Zimmerman
Subject: Is there a way to do 'one of' in a VI conditional expression?
Interesting, thanks, @Kevin Moyes!
@Jeff Schwenk, here is the conditional expression which does not yield a [syntax] error, but I don't [yet] know if it actually works. In this case we're looking for items T10 or T13 or T17, but as Kevin stated there could certainly be some false positives.
Temp001$ = "S" and POS({AR_InvoiceDetail.ItemCode$} = "T10T13T17") > 0 and (imp$[1](66,02)="02" or imp$[1](66,2)="04" or imp$[1](66,2)="11" or imp$[1](66,2)="14")
------------------------------
Brett Zimmerman
Net at Work
Greater Boston Area
------------------------------
Original Message:
Sent: 01-16-2025 11:23
From: Kevin Moyes
Subject: Is there a way to do 'one of' in a VI conditional expression?
Alnoor's very clever idea is basically searching for the ItemCode within a string... with a command that returns a number for where the text is found in the big list of concatenated values. Zero (return value) = not found.
The big risk with the strategy is when a partial match may lead to a false positive. (Eg. "/ABC123" is in your search string... and "/ABC" is not, but searching for "/ABC" would return as found because it is a part of "/ABC123").
(I've used this concept in scripts, and you can get around that risk by wrapping each value in a delimiter... where you search for the string wrapped in the delimiters, so sub-string matches would not result in false positives).
------------------------------
Kevin Moyes
Technical Systems Analyst
Munjal White Consulting Co.
Toronto ON
Original Message:
Sent: 01-16-2025 11:02
From: Jeff Schwenk
Subject: Is there a way to do 'one of' in a VI conditional expression?
@Brett Zimmerman Can you post the final expression used. It would give me a better idea of @Alnoor Cassim suggestion
------------------------------
Jeff Schwenk
Owner
Bottomline Software, Inc.
Waynesboro VA
(540) 221-4444
Improving bottom lines for over 25 years!
Original Message:
Sent: 01-16-2025 10:26
From: Brett Zimmerman
Subject: Is there a way to do 'one of' in a VI conditional expression?
Very cool, @Alnoor Cassim, thanks!!
------------------------------
Brett Zimmerman
Net at Work
Greater Boston Area
Original Message:
Sent: 01-15-2025 14:11
From: Alnoor Cassim
Subject: Is there a way to do 'one of' in a VI conditional expression?
This is one way to check for multiple item codes in a single conditional expression, using your examples of misc items.
Use this as the TRUE condition:
POS({CI_Item.ItemCode} = "/FINISH/PLAN/WIDGET") > 0
Use this as the FALSE condition:
POS({CI_Item.ItemCode} = "/FINISH/PLAN/WIDGET") = 0
Brett you would just keep adding your items to the list after /WIDGET. Think of the inner = sign as an IN operator. The POS function scans the ItemCode inside the string /FINISH/PLAN/WIDGET and tells you the column it found it in.
The "> 0" means it found it and "= 0" means it didn't find it. Hope this helps.
------------------------------
Alnoor Cassim
Accounting Systems, Inc. (ASI)