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

Load field value from a variable

I would like to get a field value from a variable, but haven't figured out the syntax. The goal is to have the same value for each row, but that value should come from a variable.

I'm building the table called Selections step-by-step and in this step I want all the values of Field_A from MyTable to be linked to value 'Advanced'

This works:

Concatenate(Selections)

LOAD

'Advanced' as Selection

, Field_A

RESIDENT MyTable;

This doesn't:

SET SelectionAlias = 'Advanced';

Concatenate(Selections)

LOAD

$(SelectionAlias) as Selection

, Field_A

RESIDENT MyTable;

I have tried a lot of things how to make the loading script to understand that it is not a field called Advanced I want to look for but instead the value 'Advanced' I want to have on every row. Hopefully it is just a simple question of correct syntax but I'm running out ideas what to try

I tried to look for similar questions but all I was able to find was how to get field values to a variable, but here I'm doing the opposite.

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

You need to keep tha variable in single quotes like this:

LOAD '$(SelectionAlias)' as Selection

, Field_A

RESIDENT MyTable;

Please see the attached sample may help you to resolve your problem.

Cheers.

View solution in original post

3 Replies
Not applicable
Author

Hi,

You need to keep tha variable in single quotes like this:

LOAD '$(SelectionAlias)' as Selection

, Field_A

RESIDENT MyTable;

Please see the attached sample may help you to resolve your problem.

Cheers.

Not applicable
Author

Thank you so much! I was thinking about trying that but then I just assumed that the field name would become to be $(SelectionAlias) instead of the Advanced. Should've tried that anyway and not trust my instinct

Not applicable
Author

Hi,

HaHaaa.

Glad it helped you.

Cheers.