Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
Can anyone help me with the below scenario.
There's a scenario below is the input table:
Expected output:
Calculation condition :
For Name=B, ID=3, Value is null, as it is null it should take above value as Name and Cross values are same.
Similarly for Name=C, for ID=5,6,7 value is null, so copy the value from ID=4 and paste it in ID=5,6,7 (Name and Cross are same)
I tried using the below condition in load script but not able to return the expected output
if(Name=previous(Name) and Cross=previous(Cross) and len(Cross)>0,peek(Value),Value))
Please find the attached sample app
Thanks & Regards,
Abhijith
Hi
this script should do the trick for you
TableTemp:
Load * inline [
ID, Name, Cross, Value,
1, A,
2, B, 1, 25
3, B, 1,
4, C, 1, 30
5, C, 1,
6, C, 1,
7, C, 1,
8, D, 5, 35
9, D, 5,
10, D,
];
Table:
load ID,
Name,
Cross,
if(Previous(Name)=Name and Previous(Cross)=Cross and len(Cross)>0 and len(Value)<1,peek('NewValue'),Value) as NewValue
Resident TableTemp
order by ID;
drop table TableTemp;
rename field NewValue to Value;
Hi
this script should do the trick for you
TableTemp:
Load * inline [
ID, Name, Cross, Value,
1, A,
2, B, 1, 25
3, B, 1,
4, C, 1, 30
5, C, 1,
6, C, 1,
7, C, 1,
8, D, 5, 35
9, D, 5,
10, D,
];
Table:
load ID,
Name,
Cross,
if(Previous(Name)=Name and Previous(Cross)=Cross and len(Cross)>0 and len(Value)<1,peek('NewValue'),Value) as NewValue
Resident TableTemp
order by ID;
drop table TableTemp;
rename field NewValue to Value;
Thanks @lironbaram