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

Split columns into one column with several ids

Hello, everyone,

I have a supposedly simple problem. I have data that looks like this:

IDcomponent1component2component3
1100101102


What I want is something like this:

IDcomponent
1100
1101
1102

 

I think I can load it with Resident and Inline, unfortunately I can't make it, could someone help me?

1 Solution

Accepted Solutions
rubenmarin

Hi, you can do a crosstable, in example:

CrossTable (componentName, component)
LOAD * Inline [
ID,	component1,	component2,	component3
1,	100,	101,	102
];

DROP Field conponentName

Instead of inline use your data source.

View solution in original post

3 Replies
rubenmarin

Hi, you can do a crosstable, in example:

CrossTable (componentName, component)
LOAD * Inline [
ID,	component1,	component2,	component3
1,	100,	101,	102
];

DROP Field conponentName

Instead of inline use your data source.

Tobschmi
Contributor II
Contributor II
Author

Hi,

that has already helped a lot! Unfortunately, I can't get any further on the second one, because I have two databases that I want to merge via Concatenate:

components:
CrossTable (components, component)
LOAD
  'LIN_'& Variation.id  as %VariationId,
  SubField(SubField(VariationBundle.components, ';', 1), ':', 1) as VariationBundle.components1,
  SubField(SubField(VariationBundle.components, ';', 2), ':', 1) as VariationBundle.components2,
  SubField(SubField(VariationBundle.components, ';', 3), ':', 1) as VariationBundle.components3

FROM [lib://QVD (ssc-qlik_qlik)/Items_LIN/Items_Lin.qvd]
(qvd);


Unqualify 'components.*';
Concatenate (components)
CrossTable (components, component)
LOAD
  'SSC_'& Variation.id  as %VariationId,
  SubField(SubField(VariationBundle.components, ';', 1), ':', 1) as components.VariationBundle.components1,
  SubField(SubField(VariationBundle.components, ';', 2), ':', 1) as components.VariationBundle.components2,
  SubField(SubField(VariationBundle.components, ';', 3), ':', 1) as components.VariationBundle.components3

FROM [lib://QVD (ssc-qlik_qlik)/Items_SSC/Items_Ssc.qvd]
(qvd);

 

But that's how I get it wrong: Illegal combination of prefixes

I guess I have to make a JOIN here, right? Unfortunately, I'm not getting anywhere on my own. Anyone else have a tip?

rubenmarin

Hi, that error is about using concatenate and crosstable in the same step, try doing it with different steps:

// Load second table data
tmpSecond:
Crosstable...

// Add tmp table to components and delete
Concatenate (components) LOAD * Resident tmpSecond;
DROP Table tmpSecond;