Sage 100

 View Only
  • 1.  Is there a way to do 'one of' in a VI conditional expression?

    Posted 01-14-2025 15:49

    Does anyone know if there's a way to do 'one of' in a VI conditional expression, similar to Crystal (e.g. {CI_Item.ItemCode} in ["/FINISH", "/PLAN", "/WIDGET"])?  Currently it's a repetitive-type formula that's causing it to apparently hit the character limit (i.e. {CI_Item.ItemCode} = xxxx or item code = 123 or item code = xyz, and so on and so on).  Trying to avoid having to create additional multiple conditional fields in the import.



    ------------------------------
    Brett Zimmerman
    Net at Work
    Greater Boston Area
    ------------------------------


  • 2.  RE: Is there a way to do 'one of' in a VI conditional expression?

    Posted 01-15-2025 14:12

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



  • 3.  RE: Is there a way to do 'one of' in a VI conditional expression?

    Posted 01-16-2025 10:27

    Very cool, @Alnoor Cassim, thanks!!



    ------------------------------
    Brett Zimmerman
    Net at Work
    Greater Boston Area
    ------------------------------



  • 4.  RE: Is there a way to do 'one of' in a VI conditional expression?

    Posted 01-16-2025 11:03

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



  • 5.  RE: Is there a way to do 'one of' in a VI conditional expression?

    Posted 01-16-2025 11:23

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



  • 6.  RE: Is there a way to do 'one of' in a VI conditional expression?

    Posted 01-16-2025 13:39

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



  • 7.  RE: Is there a way to do 'one of' in a VI conditional expression?

    Posted 01-16-2025 13:59
    Edited by Alnoor Cassim 01-17-2025 11:37

    Brett to avoid the false positives, just put some kind of delimiter character between each item. For example here I used the caret ^ symbol:

    POS({AR_InvoiceDetail.ItemCode$} = "T10^T13^T17") > 0

    This would still find T10 or T13 or T17 when it scans the whole string. I didn't mention it in my initial reply because I thought you were using misc items/charges and those of course start with a / which is already a type of delimiter.



    ------------------------------
    Alnoor Cassim
    Accounting Systems, Inc. (ASI)
    ------------------------------