Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Different ways to declare variable

Hi Experts,

      Can any one explain me regarding different ways to declare a variable with an example...how to create

Thanks & regards,

Reddi Kishor

6 Replies
raman_rastogi
Partner - Creator III
Partner - Creator III

Anonymous
Not applicable
Author

Anonymous
Not applicable
Author

Not applicable
Author

Hi kishor,

Following are the ways you can declare variables

1. Using Settings >> Variables Overview >>Add

Assign a value to the variable

2. Use keywords LET and SET in the coding window

Examples

Let C= 1+2

Treat as string

SET C = 1+2

Evaluate after = sign(numeric)

I hope this helps.

Regards,

KC

engishfaque
Specialist III
Specialist III

Dear Reddi,

Listed below are the ways through which you can create variables,

1. Using LET

2. Using SET

3. Through Variable Overview

4. Loading variables and values using For Loop in edit script such as given below,

tmp:

LOAD

  VariableName,

  VariableValue

FROM

  sales.xls;

Let vNoRows = noofrows('tmp');

For I = 0 to $(vNoRows) - 1

  Let vVarName = peek('VariableName', $(I), 'tmp');

  Let vVarValu = peek('VariableValue', $(I), 'tmp');

  Set $(vVarName) = "$(vVarValu)";

Next

Kind regards,

Ishfaque Ahmed

thakkarrahul01
Creator
Creator

This blog link is also helpful to understand basics and usage scenarios:

http://www.analyticsvidhya.com/blog/2015/06/variables-qlikview-data-stories/

Kind Regards,

Rahul Thakkar