Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Wildmatch code???

Hi all,

I want to change the content of my field based on three conditions:

-if contains '_AB' change to AB,

-if contains '_CD' change to CD,

-others leave as it is.

Where is my error in the following code? Thank you in advance!!!

LOAD

    NAME,

    IF(WILDMATCH(NAME, '*_AB*'),'AB', NAME

    and WildMatch(NAME, '*_CD*'), 'CD', NAME) as NewField

   

FROM [lib://SAMPLE/Mappe1.xlsx]

(ooxml, embedded labels, table is Tabelle1);

best,

Rustam

Tags (2)
13 Replies

Re: Wildmatch code???

try with

LOAD

NAME,
IF(Wildmatch(NAME, '*_AB*')>0, Replace(NAME, '_AB', 'AB'),
IF(Wildmatch(NAME, '*_CD*')>0, Replace(NAME, '_CD', 'CD'),
NAME

)
as NewField

FROM [lib://SAMPLE/Mappe1.xlsx]

(
ooxml, embedded labels, table is Tabelle1);

Not applicable

Re: Wildmatch code???

Try like,

=subfield(text('_AB'),'_',2) as Field

Not applicable

Re: Wildmatch code???

Hi Alessandro,

Tx! I tried it but, there  is no content like PC, or AC in my Field. The orginal code below???

LOAD

    NAME,

    IF(WILDMATCH(NAME, '*_PC*')>0, Replace(NAME,'_PC', 'PC'),

    IF(WildMatch(NAME, '*_AC')>0, Replace(NAME, '_AC', 'AC'),

    NAME)) as NewField

   

FROM [lib://MAN/Mappe1.xlsx]

(ooxml, embedded labels, table is Tabelle1);

Not applicable

Re: Wildmatch code???

Hi Harshal,

tx for reply! How do I get the other 'CD', other case here?

best,

Rustam

Re: Wildmatch code???

the code you have written should work ...

Not applicable

Re: Wildmatch code???

I see the problem, it is just changing the content

from for eg. _PC to PC,

Orginal:

12_PC=> 12PC,

But I want to change the Name of the cell of a field,

Example

12_PC => PC

13_AC => AC

123_C => 123_C

How do go about it ?

Tx in advance!!!

Not applicable

Re: Wildmatch code???

LOAD

    NAME,

    subfield(NAME),'_',2) as NewField

FROM SOURCE;


please let me know any single name fieldvalue example...


Not applicable

Re: Wildmatch code???

Hi rustam ,

may be you want like this,

A:

load subfield(name,'_',2) as New_Nmae inline [

name

12_PC

13_AC

123_C

];

Not applicable

Re: Wildmatch code???

I tried this,

it is working only for PC, but not for AC.

why???

@harshal, there are many cells like content of the field, I did not get how I could do with your code???

tx you all!

LOAD

    NAME,

    IF(WILDMATCH(NAME, '*_PC*')>0, 'PC',

    IF(WildMatch(NAME, '*_AC')>0,  'AC',

    NAME)) as NewField

   

FROM [lib://MAN/Mappe1.xlsx]

(ooxml, embedded labels, table is Tabelle1);