Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
This question is Not Answered.(Mark as assumed answered)
jasobanta230 Apr 22, 2018 12:30 AM
Hi ,
I have some list of record in city field. i want to store Bengaluru & Delhi in single variable.
Ground | Home Away |
Melbourne | Away |
Manchester | Away |
Lord's | Away |
Bengaluru | Home |
Delhi | Home |
I am trying this script but it is not working.
LET Home_ground='Bengaluru;Delhi';
if(Ground='$(Home_ground)', 'Home', 'Away');
if(Ground='$(Home_ground)', 'Home', 'Away');
This doesn't make any sense to me. What do you expect it to do?
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;
if('$(Home_ground)' like '*'&Ground&'*', 'Home', 'Away');
one example:
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
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