Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I am trying to get a specific value from the table using FieldValue(field_name, elem_no).
For example, FieldValue('Col A', 2) will give me 15.
Since elem_no is based on the load order, I am having trouble when dealing with Col 3.
Unlike other columns, Col 3 only has 2 distinct values.
FieldValue('Col 3', 3) is giving me null values because FieldValue('Col 3', 1) is 10 and FieldValue('Col 3', 2) is 20.
Col | Col A | Col 2 | Col 3 |
A | 10 | 12 | 10 |
B | 15 | 33 | 10 |
C | 30 | 65 | 20 |
D | 40 | 49 | 20 |
I am wondering if there are other functions I can use instead of FieldValue().
Is there another way to solve this problem while still using FieldValue()?
Thank you for your help in advance.
You can use crosstable when loading the table,
test:
load * Inline [
ano, 100%, 90%, 80%,
Year 1, 2%, 5%, 9%
Year 2, 4%, 14%, 20%
Year 3, 10%, 22%, 35%
Year 4, 25%, 30%, 50%
];
test2:
crosstable(%1, %2)
load * resident test;
This will create 2 colunms, crossing the name of the colunms with the corresponding value.
this article might help you:
Hello,
you can try with peek() function.
Thanks,
Ashutosh
I am trying to do this part in front end (visualization). I believe Peek() only works for the script.
I tried using Peek() in the script but I am having trouble figuring out with two loaded tables. I have the rates in one table and then I have selection in another table. Based on the selections, I am trying to get the rates from the first table to second table.
Fixed Rate Table:
100% | 90% | 80% | |
Year 1 | 2% | 5% | 9% |
Year 2 | 4% | 14% | 20% |
Year 3 | 10% | 22% | 35% |
Year 4 | 25% | 30% | 50% |
I would like to get the corresponding percentage based on the headers of rows and columns.
For example, if it is Year 1 and 90%, I should get 5%.
Year 1 | 90% | 5% |
Year 4 | 100% | 25% |
Year 3 | 80% | 35% |
I couldn't figure out how to do this in the script. That's why I moved to doing this in the visualization.
You can use crosstable when loading the table,
test:
load * Inline [
ano, 100%, 90%, 80%,
Year 1, 2%, 5%, 9%
Year 2, 4%, 14%, 20%
Year 3, 10%, 22%, 35%
Year 4, 25%, 30%, 50%
];
test2:
crosstable(%1, %2)
load * resident test;
This will create 2 colunms, crossing the name of the colunms with the corresponding value.
this article might help you:
Thank you sooo much! I think this will work.