One Star

Subtracting a value from a previous row

Good day all
I have records in my database that are updated every 10 seconds, the values accordingly increase with time. I need to calculate the difference between the two values and then write the result to another table. Does anyone have any idea how this could be accomplished. Any thoughts in this regard would be sincerely appreciated.

Re: Subtracting a value from a previous row

I think you are looking for " incremental load"(capture the changed data and only load these changed data into target table).
For community version, if there is not too much data, you might consider using a tMap which inner joins existing data with all data and then have an output which catches the reject of inner join.
For enterprise subscription version, Talend provide CDC(Change Data Capture) function. Please see the related reference:
Best regards
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Seven Stars

Re: Subtracting a value from a previous row

tInfiniteLoop -iterate-> tInput --> tJavaRow --> tOutput
In tJavaRow:
1. subtract the latest value from the previous value (stored into a variable)
2. store the new value for next time
3. modify the SQL used in the input for next time
4. send the new data for the other table