Four Stars

IF ELSE Statement in tMap

Hi everyone,

 

The field "revision" in the Output of the tMap component should be a counter, which depends on the three fields "T_SNR_SP", "T_SNR_SD" and "T_SNR_STAMM" from the Input. If there is a change in these three fields, the counter should begin at 1 again. It's like a groupchange.

Fehlermeldung1.png

 

In Java I would do it with a cache variable like these:

String T_SNR_SP_old = "";

String T_SNR_SD_old = "";

String T_SNR_STAMM_old ="";

for (int i = 1; T_SNR_SP_old==T_SNR_SP  && T_SNR_SD_old==T_SNR_SD && T_SNR_STAMM_old==T_SNR_STAMM; i ++){

          revision = i;

}

revision = 0;

T_SNR_SP_old = T_SNR_SP;

T_SNR_SD_old = T_SNR_SD;

T_SNR_STAMM_old = T_SNR_STAMM;

 

How can I do this in the tMap componente? I know, I could do this in the tJavaRow componente, but then I can't use the tMap component anymore.

Thanks Katharina

 

1 ACCEPTED SOLUTION

Accepted Solutions
Fifteen Stars

Re: IF ELSE Statement in tMap

Have a read of this tutorial and try to understand what is happening with the tMap variables. If you grasp this, you will easily be able to resolve your problem.....

 

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

Rilhia Solutions
3 REPLIES
Fifteen Stars

Re: IF ELSE Statement in tMap

Have a read of this tutorial and try to understand what is happening with the tMap variables. If you grasp this, you will easily be able to resolve your problem.....

 

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

Rilhia Solutions
Nine Stars

Re: IF ELSE Statement in tMap

Hi Katharina,

 

Are you looking for the following group id creation. Basically based on three attributes Col1,Col2 and Col3 group id will be created. If Any change in these three columns then group id will start from begin.

GroupSeq.PNG

 

Regards,

 

 

Veeru Boppudi
Four Stars

Re: IF ELSE Statement in tMap

Thanks, that solved my problem Smiley Happy