Sort and extract records based on recent date
Moderators: chulett, rschirm, roy
Sort and extract records based on recent date
Hi...I have a scenario where i have to sort the visit of a customer to a shop based on the date. I have to pick the latest three vists based on the date. I have the customer Id field and the date field. How do i extract the three records based on the recent date of visit and the customer id using datastage?
Use Sort stage to sort the input based on customer id and date on descending order. Set Create Key Change Column to true.
In transformer define counter stage variable
Use the contraint in transformer
In transformer define counter stage variable
Code: Select all
If KeyChange=1 Then svCntr=1 Else svCntr=svCntr+1
Code: Select all
svCntr <= 3
You are the creator of your destiny - Swami Vivekananda
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: