Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Naps_230
Creator
Creator

how to creating a vector of string with list of data in qlikview

This question is Not Answered.(Mark as assumed answered)

Jasobanta PradhanApprentice

Hi ,

I have some list of record in city field. i want to store  Bengaluru & Delhi in single variable.

 

GroundHome Away
MelbourneAway
ManchesterAway
Lord'sAway
BengaluruHome
DelhiHome

I am trying this script but it is not working.

LET Home_ground='Bengaluru;Delhi';

if(Ground='$(Home_ground)', 'Home', 'Away');

5 Replies
Gysbert_Wassenaar

if(Ground='$(Home_ground)', 'Home', 'Away');

This doesn't make any sense to me. What do you expect it to do?


talk is cheap, supply exceeds demand
petter
Partner - Champion III
Partner - Champion III

If you want to go from single city to a vector-string:

DATA: LOAD * INLINE [

City,Home Away

Melbourne,Home

Manchester,Away

London,Home

Newcastle,Away

Bengaluru, Home

Delhi, Away

];


LOAD

  Concat(City,';',City) AS Cities

RESIDENT

  DATA

GROUP BY

  Ceil(RecNo()/2)  // Pair them up, two and two cities

;

 

DROP TABLE DATA;

If you want to go from vector-string to single city:

DATA: LOAD * INLINE [

Cities

Melbourne;Manchester

London;Newcastle

Bengaluru;Delhi

];


LOAD

  Ceil(RowNo()/2) AS ID,

  If(Odd(RowNo()), 'Home','Away') AS [Home Away],

  SubField(Cities,';') AS City

RESIDENT

  DATA;

 

DROP TABLE DATA;

MarcoWedel

if('$(Home_ground)' like '*'&Ground&'*', 'Home', 'Away');

MarcoWedel

one example:

QlikCommunity_Thread_299171_Pic1.JPG

LET Home_ground='Bengaluru;Delhi';

table1:

LOAD Ground,

    If('$(Home_ground)' like '*'&Ground&'*', 'Home', 'Away') as [Home Away]  

FROM [https://community.qlik.com/thread/299171] (html, codepage is 1252, embedded labels, table is @1);

hope this helps

regards

Marco

MarcoWedel

Instead of storing some values in a variable, you could also use a mapping table and an ApplyMap expression to flag your home cities:

regards

Marco