Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to map values with squarebrackets into values without squarebrackets

How to map values with squarebrackets into values without squarebrackets while loading???

the below coding doesnot work..

map1:

mapping load * Inline

[

x,y

"187[32]",'187'

];

can anyone help!!!

12 Replies
Not applicable
Author

Field1 also has values without square brackets...those values are not listed..

Eg:

1111[nb 2]

2222[4]

3333[4]

4444

5555

On using Left( ), Output is

1111

2222

3333

4444 and 5555 are not listed....

Miguel_Angel_Baeyens

Hi,

Yes, because there is no index number, but a conditional should work around that

Directory;

Data:

LOAD Left(Field1, If(Index(Field1, '[') -1 <= 0, Len(Field1), Index(Field1, '[') -1))  AS Field1

FROM

test.txt

(txt, codepage is 1252, embedded labels, delimiter is '\t', msq);

So you keep using Left() but when there is no bracket, then you take all characters from value, otherwise only until the bracket.

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

Not applicable
Author

Thanks Dude...