Input Value Change
Moderators: chulett, rschirm, roy
Input Value Change
Can anyone tell me how to detect whether a particular input column in a transformer has changed to a new value or not?
Re: Input Value Change
Hi Diya,
Can you explain us with little more details.
Can you explain us with little more details.
Thank youDiya wrote:Can anyone tell me how to detect whether a particular input column in a transformer has changed to a new value or not?
If you cannot check in your output, you could also push the same results into a sequential file.
From the transformer drag all the links going to your output into the sequential file input.
Also try to restrict the number of rows passing through, if you want to look into a smaller result set.
From the transformer drag all the links going to your output into the sequential file input.
Also try to restrict the number of rows passing through, if you want to look into a smaller result set.
Narasimha Kade
Finding answers is simple, all you need to do is come up with the correct questions.
Finding answers is simple, all you need to do is come up with the correct questions.
Hi Diya,
If you are only extracting one column then try doing something this way. I am not sure abt your source. if it is a table you can extract unique rows through SQL and use this as an look up to the original table.Write constraints ( lookup=i/p then assign Y else N in the column) and insert the rows into table.If the source is a file , pass it to hash file and write constraints and merge the files.
I am not sure whether it works or not but just trying to give an idea.
thank you
If you are only extracting one column then try doing something this way. I am not sure abt your source. if it is a table you can extract unique rows through SQL and use this as an look up to the original table.Write constraints ( lookup=i/p then assign Y else N in the column) and insert the rows into table.If the source is a file , pass it to hash file and write constraints and merge the files.
I am not sure whether it works or not but just trying to give an idea.
thank you
Sort the records based on the required column. You need to compare the previous record with current record . This can be done easily via stage variable.
User three stage variable in transformer.
vIsEqual is your indicator now.
User three stage variable in transformer.
Code: Select all
vOldRec = ''
vIsEqual = ''
vCurrRec = ''
Initialise all the variable to ''
In transormer derivation,
vOldRec = vCurrRec
vIsEqual = If vOldRec = vCurrRec Then 'N' Else 'Y
vCurrRec = In.Col
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Re: Input Value Change
The simple answer to this is sure - with stage variables. However, the devil is in the details.Diya wrote:Can anyone tell me how to detect whether a particular input column in a transformer has changed to a new value or not?
![Razz :P](./images/smilies/icon_razz.gif)
Is your input data sorted? Once you've found your 'first A' will all the rest of the A's come right after it or could they anywhere? Sorting may be problematic if you need to preserve which A is the first A but I suppose a stable sort would help there.
How about a different approach, one that doesn't care if your input data is sorted? Hashed file. One field, the key field, to hold this input column to check. In the transformer, link to this hashed file twice - one as a reference lookup and again to write to it. Do a lookup against the hashed file with your value. Lookup NOTFOUND = new value, so set output column to 'Y' and write that key value to the hashed file. Lookup Not(NOTFOUND) = already seen, so just set output column to 'N'.
Two things to note. Don't cache the reference hashed file. Find a way to clear the hashed file each run. The why's and how's of each have been discussed here many times.
And for others out there in the home audience - yes, this is yet-another-way to check for duplicates.
![Wink :wink:](./images/smilies/icon_wink.gif)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers