Validation

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ghostraider
Premium Member
Premium Member
Posts: 49
Joined: Wed Dec 13, 2006 6:31 pm

Validation

Post 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
Krazykoolrohit
Charter Member
Charter Member
Posts: 560
Joined: Wed Jul 13, 2005 5:36 am
Location: Ohio

Post 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
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

You could also explore "RowProcCompareWithPreviousValue" routine to achieve it.
Last edited by narasimha on Thu Feb 22, 2007 1:11 pm, edited 2 times in total.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
ganesh123
Participant
Posts: 70
Joined: Tue Feb 20, 2007 3:22 pm
Location: NJ,USA
Contact:

Post 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
If women didn't exist, all the money in the world would have no meaning.
-- Aristotle Onassis
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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!
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ganesh123
Participant
Posts: 70
Joined: Tue Feb 20, 2007 3:22 pm
Location: NJ,USA
Contact:

Post 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
If women didn't exist, all the money in the world would have no meaning.
-- Aristotle Onassis
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Very funny ganesh123. Thats not called re-invention. Thats called enhancement. :wink:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ganesh123
Participant
Posts: 70
Joined: Tue Feb 20, 2007 3:22 pm
Location: NJ,USA
Contact:

Post by ganesh123 »

Re-invention is alwayz done for Enhancement purpose only. :lol:
If women didn't exist, all the money in the world would have no meaning.
-- Aristotle Onassis
ghostraider
Premium Member
Premium Member
Posts: 49
Joined: Wed Dec 13, 2006 6:31 pm

Post 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
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Time to mark your post as 'Resolved'.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply