Page 1 of 1

Validation

Posted: Thu Feb 22, 2007 12:23 pm
by ghostraider
Hi everybody, I am extracting two columns named SAMPLE_ID and TEST from an oracle table. Now i need to do a validation based on the condition:

If SAMPLE_ID<>Previous_SAMPLEID or TEST<>PREVIOUS_TEST Then
Sequence=0 Else Sequence=Sequence+1.

Sequence will be a new column which i have to generate. Now, can you guys let me know as to how i should deal with the If statement above. Do i need to write a subroutine?

Thanks

Posted: Thu Feb 22, 2007 12:31 pm
by Krazykoolrohit
Add Five stage variables

Code: Select all

samplVar1(definition)- If LINK.SAMPLEID = samplVAR2 then 1 else 0
samplVar2(definition)- LINK.SAMPLEID
testVar1(definition)- If LINK.TEST = testVar2 then 1 else 0
testVar2(definition) - LINK.TEST

sequence (definition) - If samplVar1 = 0 or samplVar2 = 0 then 0 else sequence+1

Posted: Thu Feb 22, 2007 1:00 pm
by narasimha
You could also explore "RowProcCompareWithPreviousValue" routine to achieve it.

Posted: Thu Feb 22, 2007 1:08 pm
by ganesh123
As you want to remember the past value of sequence better to write a subroutine :


Please send a test data, I want to know the column position in your file

Posted: Thu Feb 22, 2007 1:11 pm
by DSguru2B
No routine is required in this case. This scenario can be handled perfectly and Krazykoolrohit gave a demo on that.
If your absolutely have to use a routine, then go for narasimha's suggestion. No need to re-invent the wheel.
My 2 centy!

Posted: Thu Feb 22, 2007 1:26 pm
by ganesh123
On the lighther side, if weels have not been re-invented we would have struck with

http://patentpending.blogs.com/patent_p ... 154_pm.jpg

Posted: Thu Feb 22, 2007 1:29 pm
by DSguru2B
Very funny ganesh123. Thats not called re-invention. Thats called enhancement. :wink:

Posted: Thu Feb 22, 2007 1:38 pm
by ganesh123
Re-invention is alwayz done for Enhancement purpose only. :lol:

Posted: Fri Feb 23, 2007 9:16 am
by ghostraider
Hi all thanks much for the solution and suggestions. It is not absolutely necessary for me to use the necessary subroutine. KrazyKoolRohit's idea did work excellently.

Thanks once again :D

Posted: Fri Feb 23, 2007 9:40 am
by DSguru2B
Time to mark your post as 'Resolved'.