Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Below is my sample data:
A | B | C |
1 | 11 | 100 |
1 | 12 | 101 |
1 | 13 | 222 |
2 | 11 | 321 |
2 | 13 | 123 |
3 | 13 | 456 |
3 | 11 | 231 |
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:
A | B | C | D |
1 | 11 | 100 | 100 |
1 | 12 | 101 | 100 |
1 | 13 | 222 | 100 |
2 | 11 | 321 | 321 |
2 | 13 | 123 | 321 |
3 | 13 | 456 | 231 |
3 | 11 | 231 | 231 |
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)
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.
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;
why don't you want to use join or applymap?
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.
Order by does work on strings also . I don't think If will work... but I might be wrong