Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Team,
Need your help on below scenario.
I have two columns like column1 and column2.In column1 we have column2 data as well like (ABC,DEF).
I tried in qlikview front end its working fine. Used wildmatch function() ▼
=IF(WildMatch(Column1,'*ABC*')=1,'ABC',IF(WildMatch(Column1,'*def*')=1,'def'))
How to achieve this in backend qlikview script?
Coumn1 | Column2 |
---|---|
Data-data-ABC-store,def-data--store1 | ABC |
Data-ABC-data--store | ABC |
Data-data-ABC,Data-data-def-store2 | ABC |
def-data--store | def |
Data-data-def-store | def |
Data-data-def-def,Data-ABC-data--store | def |
Results:
Coumn1 | Column2 |
---|---|
Data-data-ABC | ABC |
Data-ABC-data--store | ABC |
Data-data-ABC | ABC |
def-data--store | def |
Data-data-def-store | def |
Data-data-def-def | def |
def-data--store1 | def |
Data-data-def-store2 | def |
You can use the exact same function syntax in the backend somehow like that:
LOAD
Column1,
Column2,
IF(WildMatch(Column1,'*ABC*')=1,'ABC',IF(WildMatch(Column1,'*def*')=1,'def')) as NewColum
FROM
File;
It seems that you need to consider that key which come first. If so, try like:
IF(Index('Column1','ABC')< Index('Column1','def'),'ABC','def') as Column2
Thanks. But here(IF(WildMatch(Column1,'*ABC*')=1,'ABC',IF(WildMatch(Column1,'*def*')=1,'def')) as NewColum) we are manually writing 'ABC','def' values in script.I don't want to write manually. If any new data comes in colum2,above formula not useful.
I am looking dynamically.
we are manually writing 'ABC','def' values in script.I don't want to write manually. If any new data comes in colum2,above formula not useful.
I am looking dynamically.
What is the logic of defining 'ABC' or 'def' to be considered in column2? Is it like: anything apart from 'data' and 'store' ?
how do you want to order it, Like first ABC than def
anything apart from 'data' and 'store' ?---->No..
Column2 data present in column1 data. based on that we have to find out.
Example: Data-data-ABC
Above example ABC is column2 data.
May be this is what you are looking for?
map1:
mapping load * inline [
x, y
data,
store,
-, ] ;
tmp:
LOAD *
,PurgeChar(MapSubString('map1', Column1), '0123456789') as Column2
INLINE [
Column1
data-ABC-data2-
store-data-def
DRT-data3-store2
];