Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Obsyky
Contributor III
Contributor III

Use an expression in the condition of a do while

My wish would be to get this type of operation, knowing that VALUEX is in TABLE :

Set a = 0;

Do While a < RangeMax(VALUEX) + 1
Left Join(TABLE)
Load
?????????
Resident TABLE
Where $(a) <= VALUEX;
Let a=a+1;
Loop

 I tried making a variable with RangeMax and Peek, but both do not return any value.

Do you have a solution? Thanks

 
Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

temp:
Load X as Key, subfield(X,'|') as Value ,'Seperate'&rowno() as Attribute Inline [
X,VALUEX
DATA | DATA1 | BIG DATA | BIG | FARM , 4
];

Generic:
Generic Load
Key,Attribute,Value Resident temp;


Set vListOfTables = ;

For vTableNo = 0 to NoOfTables()

Let vTableName = TableName($(vTableNo)) ;

If Subfield(vTableName,'.',1)='Generic' Then

Let vListOfTables = vListOfTables & If(Len(vListOfTables)>0,',') & Chr(39) & vTableName & Chr(39) ;

End If

Next vTableNo;

CombinedGenericTable:

Load distinct Key Resident temp;


For each vTableName in $(vListOfTables)

Left Join (CombinedGenericTable) Load * Resident [$(vTableName)];

 Drop Table temp;

Next vTableName

 

qlikCommunity1.PNG

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

5 Replies
vinieme12
Champion III
Champion III

this script is to filter a table and left join to another table, 

what exactly are you trying to do here  what is VALUEY and VALUEX ? please clarify

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Obsyky
Contributor III
Contributor III
Author

This is a mistake on my part, VALUEY does not exist, it is VALUEX.
VALUEX is simply the number of pipes contained in one of the attributes.
The objective is that I loop as many times as the maximum number of pipes that exist.
Then my method may not be the right one 😕
The maximum number of pipes is 324 and the objective is that I break the values into several attributes to find them in a single value.

What I would like to achieve:
(Knowing that X is the only value I have at the start)

X VALUEX SEPARATE1 SEPARATE2 SEPARATE3 SEPARATE4 SEPARATE5
DATA | DATA1 | BIG DATA | BIG | FARM 4 DATA DATA1 BIG DATA BIG FARM

I could run the loop 324 times, but if there are at most 10 pipes, I will create 314 empty attributes...

vinieme12
Champion III
Champion III

So you have X and ValueX

and you want to split X into multiple columns is that correct?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Obsyky
Contributor III
Contributor III
Author

Completely

 
vinieme12
Champion III
Champion III

temp:
Load X as Key, subfield(X,'|') as Value ,'Seperate'&rowno() as Attribute Inline [
X,VALUEX
DATA | DATA1 | BIG DATA | BIG | FARM , 4
];

Generic:
Generic Load
Key,Attribute,Value Resident temp;


Set vListOfTables = ;

For vTableNo = 0 to NoOfTables()

Let vTableName = TableName($(vTableNo)) ;

If Subfield(vTableName,'.',1)='Generic' Then

Let vListOfTables = vListOfTables & If(Len(vListOfTables)>0,',') & Chr(39) & vTableName & Chr(39) ;

End If

Next vTableNo;

CombinedGenericTable:

Load distinct Key Resident temp;


For each vTableName in $(vListOfTables)

Left Join (CombinedGenericTable) Load * Resident [$(vTableName)];

 Drop Table temp;

Next vTableName

 

qlikCommunity1.PNG

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.