Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to compress multiline data into single line?

Hi,

Part of an application that I am working on is producing a table similar to below: -

Ref123456789101112
A300000000000
B700000000000
A020000000000
B060000000000
B000000000800

I am trying to compress the data within the Load Script by Ref to achieve the following: -

Ref123456789101112
A320000000000
B760000000800

I have tried varous 'if' statements and null() but none of it appears to work.  I would be grateful for any advice on this.

Many thanks

1 Solution

Accepted Solutions
martin
Partner - Contributor II
Partner - Contributor II

Hi,

You have to do something like this in your load script :

AllTable:

CrossTable (RefNum, Content)

LOAD *

FROM MyTable;

Table:

LOAD Ref,

     RefNum,

     Sum(Content) as Sum

RESIDENT AllTable

GROUP BY Ref, RefNum;

DROP TABLE AllTable;

I'm not sure, I didn't try it. But I hope that helps you

Martin

View solution in original post

3 Replies
SunilChauhan
Champion II
Champion II

use trim of columnName in dimesion

Sunil Chauhan
martin
Partner - Contributor II
Partner - Contributor II

Hi,

You have to do something like this in your load script :

AllTable:

CrossTable (RefNum, Content)

LOAD *

FROM MyTable;

Table:

LOAD Ref,

     RefNum,

     Sum(Content) as Sum

RESIDENT AllTable

GROUP BY Ref, RefNum;

DROP TABLE AllTable;

I'm not sure, I didn't try it. But I hope that helps you

Martin

Not applicable
Author

Martin,

Thankyou it works perfectly.  I did a generic load to twist it around again.

AllTable:
CROSSTABLE (RefNum, Content)
LOAD Ref,
     [1],
     [2],
     [3],
     [4],
     [5],
     [6],
     [7],
     [8],
     [9],
     [10],
     [11],
     [12]
FROM
[test.xls]
(biff, embedded labels, table is Sheet1$);


Table:
LOAD Ref,
     RefNum,
     Sum(Content) as Sum
RESIDENT AllTable
GROUP BY Ref, RefNum;

DROP TABLE AllTable;


Table2:
GENERIC LOAD
Ref as ref2,
     RefNum,
     Sum
    
RESIDENT Table;

DROP TABLE Table;