Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
rkspareek1992
Partner - Creator
Partner - Creator

Fill specific value in field

Hi,

Below is my sample data:

ABC
111100
112101
113222
211321
213123
313456
311231

It have 3 columns. I want 4th (output column) which have the values of combination of A and B(where B=11).

My output will be like this:

 

ABCD
111100100
112101100
113222100
211321321
213123321
313456231
311231

231

6 Replies
sunny_talwar

Try this:

Table:

LOAD * INLINE [

    A, B, C

    1, 11, 100

    1, 12, 101

    1, 13, 222

    2, 11, 321

    2, 13, 123

    3, 13, 456

    3, 11, 231

];

Left Join (Table)

LOAD A,

  C as D

Resident Table

Where B = 11;

or on the front end, you can try this:

=Only(TOTAL <A> {<B = {11}>} C)

Capture.PNG

rkspareek1992
Partner - Creator
Partner - Creator
Author

Thanks..Sunny,

I wants to perform this in scripting but do not want to use join or applymap.


I had already used join and applymap.


Kindly suggest some method with use of If condition as like this:

if(B='11',A,scripting) as D

//At the place of scripting i want some logic which can map value.

sunny_talwar

If condition cannot span multiple rows. May be look at this method?

Table:

LOAD * INLINE [

    A, B, C

    1, 11, 100

    1, 12, 101

    1, 13, 222

    2, 11, 321

    2, 13, 123

    3, 13, 456

    3, 11, 231

];

FinalTable:

LOAD *,

  If(A = Previous(A), Peek('D'), C) as D

Resident Table

Order By A, B;

DROP Table Table;

MarcoWedel

why don't you want to use join or applymap?

rkspareek1992
Partner - Creator
Partner - Creator
Author

because I dont want to create another table. Because here it is huge database, so If I am using Join/Applymap, its taking more time, which reduces the performance of app.

Kindly suggest is there any other method using If condition as like below:

if(B='11',A,scripting) as D.

I cannot use order by because there are strings not numbers.

sunny_talwar

Order by does work on strings also . I don't think If will work... but I might be wrong