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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
DoubleG
Contributor II
Contributor II

Variable at existing table

Hello, it is possible to use variable (let x = SubStringCount(produkty,';') as SubStringCount) to existing table?

DoubleG_0-1692103405744.png

 

Just wanted not use manually Subfield fields( Prod1.Apt, Prod2.Apt etc.)

SubStringCount(produkty,';') as SubStringCount = 14, but only 8 Subfields have values.

Labels (1)
1 Reply
marcus_sommer

You may use something like:

set v1 = "subfield([product.Apt], ';', $1)";

to apply something like:

load *, $(v1(1)) as [Prod1.Apt], $(v1(2)) as [Prod2.Apt], ...

or even try:

set v2 = "subfield([product.Apt], ';', $1) as [Prod$1.Apt]";

for:

load *, $(v1(1)), $(v1(2)), ...

But I suggest to rethink this approach because you creates with it a crosstable which has often much more disadvantages as benefits. IMO better would be to load these data with an internal load-loop like:

load*, subfield([product.Apt], ';') as MyField from X;

or maybe with:

load*, subfield([product.Apt], ';', iterno()) as MyField, iterno() as IterNo
from X while iterno() <= substringcount([product.Apt], ';');