If, Then, Else Statement with an AND help needed

Hi all

I need an AND statement in variable below so if it finds both parts in a string it returns another value.

= If Match( ,“Partner”) Then “PARTNER” Else If Match( ,“Distribution”) Then “DISTRIBUTION” Else If Match ( ,“Partner” AND “Distrubution”) Then “BOTH” Else If Match ( ,“Direct to Customer/Prospect”)Then " Direct to Customer/Prospect" Else “”

All help appreciated


HUBBUB88 (BOB member since 2005-10-10)

Try:

= 
If Match (<Sync Description> ,"*Partner*") 
  Then "PARTNER" 
  Else If Match (<Sync Description> ,"*Distribution*")
         Then "DISTRIBUTION" 
         Else If Match (<Sync Description> ,"*Partner*") 
                 AND Match (<Sync Description> , "*Distrubution*") 
               Then "BOTH" 
               Else If Match (<Sync Description> ,"*Direct to Customer/Prospect*")
                      Then " Direct to Customer/Prospect" 
                      Else "" 

Andreas :de: (BOB member since 2002-06-20)

I quite new to BO and haven’t used the match function yet.

Are you using * as a wildcard?

If you are “PartnerDistrubution*” would work.

James


jimbomed (BOB member since 2005-08-09)

I seriously doubt this will work.


jobjoris :netherlands: (BOB member since 2004-06-30)

I did give it a try on my database first and got back the desired result.

James


jimbomed (BOB member since 2005-08-09)

We are talking about a report variable, this will only look on the dataset your database has come up with. Has nothing to do with your query on a database.


jobjoris :netherlands: (BOB member since 2004-06-30)

Thanks for the help but so far no joy. It seems to find the Partner (wildcard) part first and ignore if later on it frinds the Parter AND Distribution part.


HUBBUB88 (BOB member since 2005-10-10)

Well, that could be your answer, if you put the AND condition at the beginning of the statement it will return that result first.

Tested and found working.


Bazzer :netherlands: (BOB member since 2005-10-18)

Thanks tried this, but still no joy. Still only returns one and not both.

= If Match ( ,“Partner”) And Match ( , “Distrubution”) Then “BOTH” Else If Match ( ,“Distribution”) Then "DISTRIBUTION"Else If Match ( ,“Partner”) Then “PARTNER” Else If Match ( ,“Direct to Customer/Prospect”) Then “Direct to Customer/Prospect” Else “”

Or am I missunderstanding.

Thanks


HUBBUB88 (BOB member since 2005-10-10)

All sorted thanks for all assistance


HUBBUB88 (BOB member since 2005-10-10)