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 transpose multi field data

Hi,

I have a table with multiple addresses listed for a business. So I have a mailing address and physical address

Lets say the layout is:

BizId, PAddL1, PAddl2,Pcity,PState,PZip, MAddL1, MAddl2,Mcity,MState,MZip

How can I transpose this while loading so I can get this structure:

BizId, AddType, AddL1, Addl2,city,State,Zip

Thanks.

-Sachin

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Instead of loading multiple times from data file you can do like this by altering the way Jean-Jacques Jesua suggestion to.

TempTable:

Load

          BizId,

          PAddL1,

          PAddl2,

          Pcity,

          PState,

          PZip,

          MAddL1,

          MAddl2,

          Mcity,

          MState,

          MZip

from datafile;

MainTable:

Load

BizId,

PAddL1 as Addl1,

PAddl2 as Addl2,

Pcity as City,

PState as State,

PZip as Zip,

'Physical' as AddType

Resident

      TempTable;

Concatenate Load

BizId,

MAddL1 as Addl1,

MAddl2 as Addl2,

Mcity as City,

MState as State,

MZip as Zip,

'Mailing' as AddType

Resident

     TempTable;

Drop Table TempTable;

it reduces some more time.

Celambarasan

View solution in original post

4 Replies
Not applicable
Author

Hi

You can read your file twice like this

Load

BizId,

PAddL1 as Addl1,

PAddl2 as Addl2,

Pcity as City,

PState as State,

PZip as Zip,

'Physical' as AddType

from yourDataFile ;

Concatenate Load

BizId,

MAddL1 as Addl1,

MAddl2 as Addl2,

Mcity as City,

MState as State,

MZip as Zip,

'Mailing' as AddType

from yourDataFile ;

JJ

Not applicable
Author

I have 3.5 millions records and several fields like this in each record. This works for now, but the load is pretty slow as I am having to parse the file 4 times, with as many as 15 concat statements.

Working fine for now. But wish there was a more elegant solution.

Thanks.

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Instead of loading multiple times from data file you can do like this by altering the way Jean-Jacques Jesua suggestion to.

TempTable:

Load

          BizId,

          PAddL1,

          PAddl2,

          Pcity,

          PState,

          PZip,

          MAddL1,

          MAddl2,

          Mcity,

          MState,

          MZip

from datafile;

MainTable:

Load

BizId,

PAddL1 as Addl1,

PAddl2 as Addl2,

Pcity as City,

PState as State,

PZip as Zip,

'Physical' as AddType

Resident

      TempTable;

Concatenate Load

BizId,

MAddL1 as Addl1,

MAddl2 as Addl2,

Mcity as City,

MState as State,

MZip as Zip,

'Mailing' as AddType

Resident

     TempTable;

Drop Table TempTable;

it reduces some more time.

Celambarasan

Not applicable
Author

This seems a better approach!! Thanks.