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

Variables

Using Variable any idea to store Tables

5 Replies
SunilChauhan
Champion
Champion

can come again in brief?

Sunil Chauhan
Anonymous
Not applicable
Author

set Variable =  select * from Employee like wise

let Variable =  Variable + select * from Employee like wise

johnw
Champion III
Champion III

Maybe this?

LOAD *
;
SQL
SELECT EmployeeName
FROM Employee
WHERE EmployeeID = 12345
;
LET Variable = peek('EmployeeName')
;

Anonymous
Not applicable
Author

Hi john,

i want to stroe all columns in one Variable.is it possible...Variable is like a function in sqlserver right..in sqlserver we write  three type of function ..Tabled Value Function it returns Tables,Scalar Value Function it Returns Values  and Aggregate functions  it Return Grouped Value.....but in qlikview we write only Scalar Value Function...Variable Returns Values Only..is Any way to return Tables...

LOAD *
;
SQL
SELECT EmployeeName,EmployeeID,Salary,Department
FROM Employee
;
LET Variable = peek('EmployeeName',' EmployeeID','Salary','Department');

is it Correct?

johnw
Champion III
Champion III

A variable isn't a function.  It's just a place to store a value. 

Maybe this?

LET Variable = peek('EmployeeName') & ',' & peek('EmployeeID') & ...;

That just gives you one row, though.  All columns, one row.  All columns, all rows, comma delimited would look something like this:

LOAD concat(EmployeeName & ',' & EmployeeID & ...,'
') as AllMyData; // is is important that this is on a separate line - it's how you get separate lines in your data
SQL
SELECT EmployeeName,EmployeeID,...
FROM Employee
;
LET Variable = peek('AllMyData');

I don't have any idea why you'd do something like that, but you could.