Skip to content
+1-888-319-3663

COMMUNITY FORUM

IF…THEN… referencing two separate fields in SmartConnect Map

Andrew asked 3 years ago
I have two fields to evaluate…Division and Region.
There are only Divisions (North, South, Pacific).
There are several Regions, so let’s just call them NW, NE, SE, SW, Pacific.
All customers will come in using their assigned Division, except for Pacific.
If they are located in Hawaii…their Division needs to be South.
If they are located in Alaska…their Division needs to be North.
I think it should be simple (simple enough in SQL), but I can’t seem to figure out how to get my map to evaluate two fields without doing a traditional IF…THEN…statement.
Thank you!
Answers
Patrick Roth Staff answered 3 years ago
What is wrong with using a traditional if/then statement?
If you only have a few conditions as above, if/then is perfectly acceptable and might be faster than a case statement:
https://www.dotnetperls.com/select-vbnet
In your example, we aren’t looking at the region at all.  The state, yes, but not the region.  And really just looking at Division for the two special cases.
So I’m assuming that for each state, we’ll use whatever the division in the source data is set to other than Hawaii/Alaska.
‘set our division variable to whatever is in the source
dim myDivision as string = _DIVISION
select case _STATE.ToUpper()
 case “HAWAII”
      myDivision =”SOUTH”
  case “ALASKA”
      myDivision=”NORTH”
end select
return myDivision
 
 
 

If you would like to submit an answer or comment, please sign in to the eOne portal.