current date () - 6 months
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 729
- Joined: Tue Apr 28, 2009 10:49 pm
current date () - 6 months
All,
I have a file like below.
100|201005|2.345
100|201006|1.342
100|201007|0.345
100|201008|5.343
100|201009|1.375
100|201010|6.345
100|201011|7.345
100|201012|8.345
100|201101|1.345
100|201102|1.222
100|201103|6.333
200|201005|2.345
200|201006|1.342
200|201007|0.345
200|201008|5.343
200|201009|1.375
200|201010|6.345
200|201011|7.345
200|201012|8.345
200|201101|1.345
200|201102|1.222
200|201103|6.333
I would like filter only the last 6 month data in another file.
100|201010|6.345
100|201011|7.345
100|201012|8.345
100|201101|1.345
100|201102|1.222
100|201103|6.333
200|201010|6.345
200|201011|7.345
200|201012|8.345
200|201101|1.345
200|201102|1.222
200|201103|6.333
Inputs are welcome!
I have a file like below.
100|201005|2.345
100|201006|1.342
100|201007|0.345
100|201008|5.343
100|201009|1.375
100|201010|6.345
100|201011|7.345
100|201012|8.345
100|201101|1.345
100|201102|1.222
100|201103|6.333
200|201005|2.345
200|201006|1.342
200|201007|0.345
200|201008|5.343
200|201009|1.375
200|201010|6.345
200|201011|7.345
200|201012|8.345
200|201101|1.345
200|201102|1.222
200|201103|6.333
I would like filter only the last 6 month data in another file.
100|201010|6.345
100|201011|7.345
100|201012|8.345
100|201101|1.345
100|201102|1.222
100|201103|6.333
200|201010|6.345
200|201011|7.345
200|201012|8.345
200|201101|1.345
200|201102|1.222
200|201103|6.333
Inputs are welcome!
Karthik
-
- Premium Member
- Posts: 729
- Joined: Tue Apr 28, 2009 10:49 pm
Sorry, it just irks me when people post a question and it seems like there's been no thought put into getting the answer themselves, where they just post a problem and then sit back and wait for the answer to fall into their laps. Not saying that is what is going on here, just wanted to get that off my chest.
One solution: viewtopic.php?t=111266
One solution: viewtopic.php?t=111266
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Well, here is one way to get your results, though I'd check your resulting file carefully :D .
For this, define your YYYYMM column in your sequential file as integer. Create a stage variable - in this example I named it 'CUTOFF'. This is defined as follows:
In your transformer stage, have a constraint on the link to your output file, and do a comparison, like DSLink3.YEARMO >= CUTOFF.
It gives the correct output, though I'm probably jumping through more hoops than necessary to do this ....
For this, define your YYYYMM column in your sequential file as integer. Create a stage variable - in this example I named it 'CUTOFF'. This is defined as follows:
Code: Select all
StringToDecimal(DateToString(DateFromDaysSince(-182,CurrentDate()),"%yyyy%mm"),"trunc_zero").
It gives the correct output, though I'm probably jumping through more hoops than necessary to do this ....
-
- Participant
- Posts: 91
- Joined: Wed Apr 20, 2005 7:59 pm
- Location: U.S.
Huh???mobashshar wrote:In transformer stage, Sort the input Date Column in DESC order and using constraint send out the First Six Rows.
If you are running your job in parallel use this in constraint to filter the last 6 months: (((@INROWNUM -1) * @NUMPARTITIONS) + @PARTITIONNUM + 1) <= 6
Hope this helps
I think you misunderstood him - he wants the data from the last 6 months - not just 6 rows of data ...
-
- Participant
- Posts: 14
- Joined: Thu Jul 10, 2008 7:37 am
- Location: mumbai
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI
Depends on the definition on 6 months. it can be either that orray.wurlod wrote:How about DateFromDaysSince() with an offset of -183 ? ...
Code: Select all
if(link.field[5,2] <=6) Then (link.field[1,4]-1):12+link.field[5,2] - 6 else link.field[1,4]:link.field[5,2]-6
Priyadarshi Kunal
Genius may have its limitations, but stupidity is not thus handicapped.
Genius may have its limitations, but stupidity is not thus handicapped.
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: