Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Table:
ColA ColB
A A1
B B1
C A1
D A1
E C1
F B1
When I do a FieldValue('ColB', 5) it is not returning anything. This is cos FieldValue takes distinct values of the column, and picking from that, pretty much defeating the column look up functionality.
Is there any way to achieve this, using the values in ColB as they are and not eliminating duplicates.
Wanted: FieldValue('ColB', 5) should return C1.
Note: This is to be used in Charts, not on scripting side.
Sorry, misread the Note you sent.
You could use the only statement combined with set analysis to verify the value you want.
Example:
Data generating script:
x:
load * Inline
[
ColA ,ColB
A ,A1
B ,B1
C ,A1
D ,A1
E ,C1
F ,B1
];
data:
Load
RowNo() as Index,
*
Resident x;
drop table x;
// End of script part
Chart expressions:
only({<ColA={'B'}>}ColB)
only({<Index={1}>}ColB)
Which gives:
Hi Srinivas,
Use peek instead of fieldvalue, like below:
x:
load * Inline
[
ColA ,ColB
A ,A1
B ,B1
C ,A1
D ,A1
E ,C1
F ,B1
];
let x = peek('ColB',0,'x');
This will return 'A1' (the index starts as 0) and say you want the 5th row value, would be:
let x = peek('ColB',4,'x');, which returns 'C1'.
Felipe.
Thanks Felip, but Peek is a script only function. I need the look up in chart.
Sorry, misread the Note you sent.
You could use the only statement combined with set analysis to verify the value you want.
Example:
Data generating script:
x:
load * Inline
[
ColA ,ColB
A ,A1
B ,B1
C ,A1
D ,A1
E ,C1
F ,B1
];
data:
Load
RowNo() as Index,
*
Resident x;
drop table x;
// End of script part
Chart expressions:
only({<ColA={'B'}>}ColB)
only({<Index={1}>}ColB)
Which gives:
Thanks Felip... shall try this approach, though a chart only change would have been ideal.