Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Switch variable name

Hi,

See the attached application. What I want to do is using the button (DB) to switch names and values ​​for These variables
from their names in the database to plain text.

Eg
I have a variable for gender. It's called "SexCode" in the database but only "Sex" in the plain text. Values ​​for the units "1"
and
"2" in the database, but "Male" and "Female" in the plain text.
 

When I click the button DB then I want to show "Sex" instead of "SexCode"and "Male" instead of "1".

I have a table (Variables) for what these variables named in the database and in plain text.

I have over 100 of variables in 15 tables. The above is just an example.

Thanks in advance for the help.

Stravan

3 Replies
rbecher
MVP
MVP

Hi Khabat,

see attached. It's a mix of FieldValue() for labels and if() for the fields. But for dynamic fields you will need to use a straight table chart instead of table object.

- Ralf

Astrato.io Head of R&D
Not applicable
Author

Hi Ralf, Thanks for your response. Do you know if you can do it in any other way using something else instead of FieldValue ()?

FieldValue () needs elem_no and this can be difficult to keep track of if you have more than 100 variables.

This would be perfect if you had a function like lookup () with the help of FieldName to retrieve FieldNameDB and FieldNamePlainText (ie switching between FieldNameDB and FieldNamePlainText as the field names in the tables using the button), see the new table (Variables2) as are in the script.

Thanks so much.

Khabat

rbecher
MVP
MVP

Hi Khabat,

LookUp() works in script only but you can use a combination like this:

=FieldValue('$(vDisplayLabel)',FieldIndex('FieldName','acc_nr'))

- Ralf

Astrato.io Head of R&D