Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
su_pyae
Creator
Creator

FieldValue() or something similar

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. 

Labels (1)
1 Solution

Accepted Solutions
Vinicius_12
Partner - Contributor II
Partner - Contributor II

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:

https://help.qlik.com/en-US/sense/November2021/Subsystems/Hub/Content/Sense_Hub/LoadData/work-with-c...

View solution in original post

4 Replies
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hello,

you can try with peek() function.

 

Thanks,

Ashutosh

su_pyae
Creator
Creator
Author

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. 

Vinicius_12
Partner - Contributor II
Partner - Contributor II

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:

https://help.qlik.com/en-US/sense/November2021/Subsystems/Hub/Content/Sense_Hub/LoadData/work-with-c...

su_pyae
Creator
Creator
Author

Thank you sooo much! I think this will work.