Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have shipping orders with a FromState and a ToState. I am trying to determine if the orders are within the same state and within the United States. We also have counrtry codes like CN for Canada, hence the need for the 50 state variable.
I have created a load inline for all 50 states.
LOAD * INLINE [
State
AK
AL
AR
AZ
CA
CO
...etc.
];
Placed these into an Array of vStates and then tried the following.
if(FromState = ToState and match(FromState, $(vStates)), 'SameState') as IsFromUSState
The Variable loads fine without the formula above in the load statement for use within the document.
but the formula above gets the error:
Field not found - <AK>
LOAD
FromState,
ToState,
Qty,
AK,AL,AR,AZ,CA,CO,CT,DC,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY as IsFromUSState
FROM
[..\MyTable.qvd]
(qvd)
as if it's trying to load the States from MyTable vs. matching them against the variable.
Thanks
You should use exists in this case
Where exists(State, fromState)
Or, more accurately: if(FromState = ToState and exists(State,FromState),'SameState') as IsFromUSState
Regards,
Vlad