View previous topic :: View next topic
|
Author |
Message |
ajayvamsi
New User
Joined: 21 Jul 2005 Posts: 56 Location: Hyderabad
|
|
|
|
Hi all,
when I faced an interview they asked me what is the diffrence b/w
EVALUATE TRUE
WHEN PLAN = '545' OR '656'
....
WHEN OTHER
END-EVALUTE
and
EVALUATE TRUE
WHEN PLAN = '545' ALSO '656'
....
WHEN OTHER
END-EVALUTE
wat is the difference these two statements...please help me out...!!
_________________
Have a nice day |
|
Back to top |
|
|
shivashunmugam Muthu
Active User
Joined: 22 Jul 2005 Posts: 114 Location: Chennai
|
|
|
|
Hey...
In my understanding, 'ALSO' normally coded to check additional parameter's statements. U cannot use ALSO for the same variable.
like
we can check
EVALUATE TRUE
WHEN AGE >13 ALSO SEX = 'M'
If we use for the same variable....it has no meaning.. Both are same... |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Hi ajayvamsi,
ALSO is used in EVALUATE statement to differentiate between subjects & objects mentioned in the condition.....
for ex...
Code: |
EVALUATE AGE ALSO SEX
WHEN 22 ALSO M ...
WHEN 18 ALSO F.... |
Like that you differentiate between variables thru ALSO....
Hope I m clear....
Regards,
Priyesh. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi ajayvamsi,
I haven't compiled this, so I don't know if Shiva is right, but you could try:
EVALUATE TRUE ALSO TRUE
WHEN PLAN = '545' ALSO PLAN = '656'
....
WHEN OTHER
END-EVALUTE
The only problem is that the WHEN can never test TRUE. ALSO means "and" not "or".
P.S. The 1st example can be coded as below with the same result:
EVALUATE PLAN
WHEN '545'
WHEN '656'
....
WHEN OTHER
END-EVALUTE |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
As I earlier said.....
Quote: |
ALSO is used in EVALUATE statement to differentiate between subjects & objects mentioned in the condition |
The Variable mentioned after EVALUATE VERB is the subject in this case & the values being checked inside the EVALUATE is objects for that.
Like...
Code: |
EVALUATE AGE
WHEN 22...
WHEN 24...
.... |
AGE is subject in this case & 22, 24 are the objects for that.
Quote: |
I haven't compiled this, so I don't know if Shiva is right, |
In SHIVA's case number of subjects are less than number of objects, so it fails in compiling.
But what he said is meaningfull....
Quote: |
If we use for the same variable....it has no meaning.. Both are same... |
ALSO means AND, not OR....So if you want to check value of PLAN for 545 OR 656...you should give two WHEN in EVALUATE stmt with same Execuatable stmts.
mmwife....In your code.....
Code: |
EVALUATE TRUE ALSO TRUE
WHEN PLAN = '545' ALSO PLAN = '656'
....
WHEN OTHER
END-EVALUTE |
Will control ever go in first WHEN.....Syntactically its fine.....Solution lies in the second code given by you.
Regards,
Priyesh. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Priyesh,
Quote: |
ALSO means AND, not OR....So if you want to check value of PLAN for 545 OR 656...you should give two WHEN in EVALUATE stmt with same Execuatable stmts. |
Quote: |
Will control ever go in first WHEN.....Syntactically its fine.....Solution lies in the second code given by you. |
That's what I meant when I said:
Quote: |
The only problem is that the WHEN can never test TRUE. ALSO means "and" not "or". |
|
|
Back to top |
|
|
Karthikt
New User
Joined: 15 Aug 2005 Posts: 51
|
|
|
|
Hi,
ALSO Means and. When you are using this parameter, it should satisfy both the conditions. Then only it will process up for the statements down below the WHEN.
Correct me if I am wrong. |
|
Back to top |
|
|
|