Four Stars

How to get next record's value while processing an input ?

 
  • Data Integration
  • Exchange components
5 REPLIES
Eleven Stars

Re: How to get next record's value while processing an input ?

I believe this tutorial will help with this.....

 

https://www.rilhia.com/quicktips/quick-tip-compare-row-value-against-value-previous-row

 

If you want to "look ahead" you simply adjust this slightly to hold processing the first row until the second has arrived. Thus allowing you to appear to "look ahead"

Rilhia Solutions
Four Stars

Re: How to get next record's value while processing an input ?

Can you please explain it in detail ? how is it possible to get the next row ?

 

Thanks ,

Praveen.

Eleven Stars

Re: How to get next record's value while processing an input ?

It is not possible for the current row to get the "next" as such. So what I am suggesting is using a variation on what that tutorial shows. 

 

When your job reads the first row, it is essentially stored in memory. Then, when the second row arrives, the first row does what it needs to with the second row's data, is released and then the second row is stored in memory. This goes on throughout the job until you get to the end of the data set.

 

This is enabled by the fact that the tMap variables are processed from top to bottom and are held between data rows. Using this functionality (as described in the tutorial....you can literally follow it and recreate it in an example job to see it happening), you can do this inter-row calculation.

Rilhia Solutions
Four Stars

Re: How to get next record's value while processing an input ?

In my scenario , current row's data will be modified as per next row's data .So as per your suggestion if i store the first row data in a variable and wait for the second row to arrive , i can compare that with the variable value but how can i edit the previous row data based on this comparison ?

Thanks ,

Praveen . 

Eleven Stars

Re: How to get next record's value while processing an input ?

The previous row's data is in memory. You can edit it in memory as well.

When you output the variables that the row columns are stored in, you can modify the data there....or do it in another tMap variable. 

 

This isn't *easy*, but it is possible and quite logical when you get your head into it. Try it out. The best way to learn something like this is to test it in an example job.

 

Rilhia Solutions