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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
samuel_brierley
Creator
Creator

My first variable


Hi all,

can anyone spot an error with this variable,

ive put the formula i a text box to ensure it works and its fine,

Set V1 = =only( {$< [/rec] = {'upstream'},  [/rec/parameter] = {'mosAddress'}>}[/rec/parameter/curval]);

4 Replies
Anonymous
Not applicable

Could it be the 2 equals signs after the V1 ?

dickelsa
Creator
Creator

Hi Samuel

First of al, delete the second '='  in the line, if you are not using quote symbols. seeing that you want to use set analysis, i would recommend the ''  symbols.

it should look like this:

SET V1 = ' =only( {$< [/rec] = {'upstream'},  [/rec/parameter] = {'mosAddress'}>}[/rec/parameter/curval])' ;


if you want to apply the variable in the script, set analysis is not your friend. that will only work in  the actual document. You should maybe try

if() and where clauses


regards,


Dick

Not applicable

Since you posted a "set" statement I think you're trying to load a variable in load script using qlikview "set expression", which use is possible only in the document, and it returns correct value, but not in load statement.


To generate a calculated variable in the script, starting from a single field previously loaded, the correct statement is "LET", anyway, you have to proceed in two distinct steps:


1 Load Temporary Table, Example:


TemporaryRPC:

LOAD

Distinct

[/rec/parameter/curval]

Resident YourTableName // INSERT YOUR QLIK TABLE NAME

Where [/rec] = 'upstream' and [/rec/parameter] = 'mosAddress';


2 LET STATEMENT WITH PEEK FUNCTION, Example:


LET V1 = Peek('[/rec/parameter/curval]',0,'YourTableName');


3 DROP TEMPORARY TABLE, Example:


DROP Table TemporaryRPC;



However, you should have to post an example qvw if you can.

Not applicable

Did you try this?