QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Rules, plus terms and conditions, can be found here.
New Contributor III

Dissociate a field a field into 2 field

Hello

I have this table :

 N° N° doc 1 FAA03 1 VVV03 2 FAA04 2 VVV04 3 FAA05 3 VVV06 4 VVV08 4 FAA05

I went to get this table :

 N° N° doc  FAA N° doc VVV 1 FAA03 VVV03 2 FAA04 VVV04 3 FAA05 VVV06 4 VVV08 FAA05
1 Solution

Accepted Solutions
Valued Contributor III

Re: Dissociate a field a field into 2 field

A simple way to do this:

_tmp:

N°, N° doc

1, FAA03

1, VVV03

2, FAA04

2, VVV04

3, FAA05

3, VVV06

4, VVV08

4, FAA05

];

Result:

N°,

[N° doc] as [N° doc FAA]

RESIDENT

_tmp

WHERE

left([N° doc], 3) = 'FAA'

;

LEFT JOIN (Result)

N°,

[N° doc] as [N° doc VVV]

RESIDENT

_tmp

WHERE

left([N° doc], 3) = 'VVV'

;

DROP TABLE _tmp;

12 Replies
Valued Contributor III

Re: Dissociate a field a field into 2 field

A simple way to do this:

_tmp:

N°, N° doc

1, FAA03

1, VVV03

2, FAA04

2, VVV04

3, FAA05

3, VVV06

4, VVV08

4, FAA05

];

Result:

N°,

[N° doc] as [N° doc FAA]

RESIDENT

_tmp

WHERE

left([N° doc], 3) = 'FAA'

;

LEFT JOIN (Result)

N°,

[N° doc] as [N° doc VVV]

RESIDENT

_tmp

WHERE

left([N° doc], 3) = 'VVV'

;

DROP TABLE _tmp;

Honored Contributor III

Re: Dissociate a field a field into 2 field

Hi,

Temp:
FROM
"https://community.qlik.com/message/1327323"
(html, codepage is 1252, embedded labels, table is @1);
Table:
Resident Temp Where Rank=1;
Join LOAD ,[N° doc] as NDocV
Resident Temp Where Rank=2;
Drop Table Temp;

Regards,

Antonio

New Contributor III

Re: Dissociate a field a field into 2 field

But I have another question, if I have a table like:

 N° N° doc 1 FAA03 1 VVV03 2 FAA04 2 AAA23 2 VVV04 3 AAA23 3 VVV04 3 FAA05 3 VVV06 4 VVV08 4 FAA05

And I want to dissociate   in 3 or 4 fileds ??

like this :

 N° N° doc  FAA N° doc VVV N° doc VVV 1 FAA03 VVV03 _ 2 FAA04 VVV04 AAA23 3 FAA05 VVV06 AAA23 4 VVV08 FAA05 _

Honored Contributor III

Re: Dissociate a field a field into 2 field

Why

Row 2 FAA04-VVV04-AAA23

and

Row 4 VVV08-FAA05

Honored Contributor III

Re: Dissociate a field a field into 2 field

Is it this the expected result ?

New Contributor III

Re: Dissociate a field a field into 2 field

yes exctly,

how can I do??

Honored Contributor III

Re: Dissociate a field a field into 2 field

Temp:
FROM
"https://community.qlik.com/message/1327323"
(html, codepage is 1252, embedded labels, table is @3);
Table:
Resident Temp Where Rank=1;
Join LOAD ,[N° doc] as NDocV
Resident Temp Where Rank=2;
Join LOAD ,[N° doc] as NDocA
Resident Temp Where Rank=3;
Drop Table
Temp;

MVP

Re: Dissociate a field a field into 2 field

One option could be this

Table:

KeepChar([N° doc], 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') as Field;

N°, N° doc

1, FAA03

1, VVV03

2, FAA04

2, AAA23

2, VVV04

3, AAA23

3, VVV04

3, FAA05

3, VVV06

4, VVV08

4, FAA05

];

FinalTable:

Resident Table;

FOR i = 1 to FieldValueCount('Field')

LET vField = FieldValue('Field', \$(i));

Left Join (FinalTable)

[N° doc] as ['N° doc' \$(vField)]

Resident Table

Where Field = '\$(vField)';

NEXT

DROP Table Table;

New Contributor III

thank you  pro