Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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

13 Replies
alexandros17
Partner - Champion III
Partner - Champion III

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
Author

Try like,

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

Not applicable
Author

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
Author

Hi Harshal,

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

best,

Rustam

alexandros17
Partner - Champion III
Partner - Champion III

the code you have written should work ...

Not applicable
Author

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
Author

LOAD

    NAME,

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

FROM SOURCE;


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


Not applicable
Author

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
Author

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);