Page 1 of 1

how to get last value in each row

Posted: Wed Jun 20, 2012 2:01 am
by jhansi
source
a
a_b
a_b_c
a_b_c_d

target
a
b
c
d

Posted: Wed Jun 20, 2012 2:22 am
by chetan.c
Hi,

In the output derivation:

Code: Select all

field(DSLink2.val,"_", @INROWNUM)
Transformer has to run in sequential mode.


Thanks,
Chetan.C

Posted: Wed Jun 20, 2012 7:07 am
by chulett
I seriously doubt that example actually represents the incoming data such that you can assume the last field will always match the row number. A generic answer would be to count() the delimiters and pull the "count+1" field from the "_" delimited string.

Posted: Thu Jun 21, 2012 9:51 am
by trammohan
DSLink8.val[ Len(Trim(DSLink8.val )),1]

Posted: Thu Jun 21, 2012 10:43 am
by chulett
trammohan wrote:DSLink8.val[ Len(Trim(DSLink8.val )),1]
Again, I think people are putting too much faith in the accuracy of the example posted. They want the last "value" / field, not the last character.

Posted: Thu Jun 21, 2012 5:31 pm
by ray.wurlod

Code: Select all

Field(InLink.TheString, delimiter, Count(InLink.TheString, delimiter) + 1, 1)

Posted: Thu Jun 21, 2012 5:32 pm
by ray.wurlod

Code: Select all

Field(InLink.TheString, delimiter, Count(InLink.TheString, delimiter) + 1, 1)

Posted: Thu Jun 21, 2012 5:32 pm
by chulett
Just like I said. :wink: