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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Set one whole field as an variable

Hi,

I don't know if this is possible or if there may be another solution to this.

I want a variable to contain all id's in one field. In the example below i want all the car_id's from the sybase_table. If the field contains 3 ids, it would look like this: '123','321','546'. Reason i want this is because i will use this variable in a later SQL.

SQL Select "'" + car_id + "'" + "," as car_id

from Sybase_database;

SET vCar_id = 'All car_id's in on e string'

I the want to use this variable in SQL-query in a oracle_table:

select * from oracle_database

where car_id in (vCar_id)

2 Replies
marcus_sommer

You could use something like this:

FilterTable:

SQL Select "'" + car_id + "'" + "," as car_id

from Sybase_database;

FilterTablerConcat:

load concat(car_id, ',') as car_id_concat resident FilterTable;

SET vCar_id = peek('car_id_concat', 0, 'FilterTableConcat');

drop tables FilterTable, FilterTableConcat;

- Marcus

vinieme12
Champion III
Champion III

CarIDs:

Load

concat(car_id , '+') as CarIDList

SQL Select Distinct car_id

from Sybase_database;

Set vCarIDs = peek('CarIDList',0,'CarIDs');

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.