Hi,
Iam new to DS.
Iam defining a StageVariabe svLocId like
If x='hyd' then 1234
Else If x='delhi' then 3456
Else If x='Bangalore' then
(If (zipcd>2456 and zipcd<2500) Then = 8976 else 8977)
Else If x='Bombay' then
(If (zipcd>2456 and zipcd<2500) Then = 8976 else 8977)
Else 9999
Can i define in this way or not.
If i ask a stupid question please bear me.
TIA
StageVariable
Moderators: chulett, rschirm, roy
Welcome Aboard! :D
I think your expression is fine... syntactically, except for the extra equal signs:
Or, to save a little code:
Best way to check the output is to write a quick routine via the Manager with that exact syntax. Pass in two arguments and either rename them to match your names or change all references to 'x' and 'zipcd' in your code to 'Arg1' and 'Arg2'. Then you'll need to assign the output to the variable 'Ans' which is required. So the routine code would look like:
Save, Compile and then you can use the 'Test' button to run various values of Arg1 throught it to ensure you get the right Answer back each time. ![Wink :wink:](./images/smilies/icon_wink.gif)
I think your expression is fine... syntactically, except for the extra equal signs:
Code: Select all
If x='hyd' then 1234
Else If x='delhi' then 3456
Else If x='Bangalore' then
(If (zipcd>2456 and zipcd<2500) Then 8976 else 8977)
Else If x='Bombay' then
(If (zipcd>2456 and zipcd<2500) Then 8976 else 8977)
Else 9999
Code: Select all
If x='hyd' then 1234
Else If x='delhi' then 3456
Else If x='Bangalore' or x='Bombay' then
(If (zipcd>2456 and zipcd<2500) Then 8976 else 8977)
Else 9999
Code: Select all
If Arg1='hyd' then Ans=1234
Else If Arg1='delhi' then Ans=3456
Else If Arg1='Bangalore' or Arg1='Bombay' then
(If (Arg2>2456 and Arg2<2500) Then Ans=8976 else Ans=8977)
Else Ans=9999
![Wink :wink:](./images/smilies/icon_wink.gif)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Thanks Craig
chulett wrote:Welcome Aboard! :D
I think your expression is fine... syntactically, except for the extra equal signs:
Or, to save a little code:Code: Select all
If x='hyd' then 1234 Else If x='delhi' then 3456 Else If x='Bangalore' then (If (zipcd>2456 and zipcd<2500) Then 8976 else 8977) Else If x='Bombay' then (If (zipcd>2456 and zipcd<2500) Then 8976 else 8977) Else 9999
Best way to check the output is to write a quick routine via the Manager with that exact syntax. Pass in two arguments and either rename them to match your names or change all references to 'x' and 'zipcd' in your code to 'Arg1' and 'Arg2'. Then you'll need to assign the output to the variable 'Ans' which is required. So the routine code would look like:Code: Select all
If x='hyd' then 1234 Else If x='delhi' then 3456 Else If x='Bangalore' or x='Bombay' then (If (zipcd>2456 and zipcd<2500) Then 8976 else 8977) Else 9999
Save, Compile and then you can use the 'Test' button to run various values of Arg1 throught it to ensure you get the right Answer back each time.Code: Select all
If Arg1='hyd' then Ans=1234 Else If Arg1='delhi' then Ans=3456 Else If Arg1='Bangalore' or Arg1='Bombay' then (If (Arg2>2456 and Arg2<2500) Then Ans=8976 else Ans=8977) Else Ans=9999