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: 
SatyaPaleti
Creator III
Creator III

Need to get substrings from string

Hi Everyone,

Can some one please help me to achieve this. I have following string

AllTables = Emp_Name_Table,Emp_id_Table,Emp_DOJ_Table,Dept_Nam_Table,Dept_id_Table,Dept_doj_Table

I am having Emp Tables and Dept Tables but I want to show only Dept Tables.

can some one please help to resolve this

Thanks,

Labels (1)
1 Solution

Accepted Solutions
HugoRomeira_PT
Creator
Creator

Hello,

 

Hope the following code helps you:

 



/*STEP 1 - Load the string for test purposes, in case you have a table or a variable you just need to adjust the code to fit with the next steps logic*/ 

SET AllTables = Emp_Name_Table,Emp_id_Table,Emp_DOJ_Table,Dept_Nam_Table,Dept_id_Table,Dept_doj_Table;

NoConcatenate
AllTablesTable:
LOAD '$(AllTables)' as AllTables
AutoGenerate 1;





/*STEP 2 - Deaggregate the field values into a table, using subfield, and than filter where the string Dept is present*/ 

NoConcatenate
AllValues_Table:
LOAD AllTable_Values
WHERE WildMatch(AllTable_Values,'*Dept*')=1
;
LOAD SubField(AllTables,',') as AllTable_Values
Resident AllTablesTable
;

/*STEP 3 - Transform the values back into a unique string*/ 

NoConcatenate
DepTablesValue:
LOAD Concat(DISTINCT AllTable_Values,',') as Depart_Tables
Resident AllValues_Table;

Drop table AllValues_Table,AllTablesTable;
If the issue is solved please mark the answer with Accept as Solution.
If you want to go quickly, go alone. If you want to go far, go together.

View solution in original post

2 Replies
HugoRomeira_PT
Creator
Creator

Hello,

 

Hope the following code helps you:

 



/*STEP 1 - Load the string for test purposes, in case you have a table or a variable you just need to adjust the code to fit with the next steps logic*/ 

SET AllTables = Emp_Name_Table,Emp_id_Table,Emp_DOJ_Table,Dept_Nam_Table,Dept_id_Table,Dept_doj_Table;

NoConcatenate
AllTablesTable:
LOAD '$(AllTables)' as AllTables
AutoGenerate 1;





/*STEP 2 - Deaggregate the field values into a table, using subfield, and than filter where the string Dept is present*/ 

NoConcatenate
AllValues_Table:
LOAD AllTable_Values
WHERE WildMatch(AllTable_Values,'*Dept*')=1
;
LOAD SubField(AllTables,',') as AllTable_Values
Resident AllTablesTable
;

/*STEP 3 - Transform the values back into a unique string*/ 

NoConcatenate
DepTablesValue:
LOAD Concat(DISTINCT AllTable_Values,',') as Depart_Tables
Resident AllValues_Table;

Drop table AllValues_Table,AllTablesTable;
If the issue is solved please mark the answer with Accept as Solution.
If you want to go quickly, go alone. If you want to go far, go together.
vinieme12
Champion III
Champion III

let vstring = 'Emp_Name_Table,Emp_id_Table,Emp_DOJ_Table,Dept_Nam_Table,Dept_id_Table,Dept_doj_Table';

temp:
Load tablenames
Where WildMatch(tablenames,'Dept_*')
;
Load SubField(val,',') as tablenames
;
Load '$(vstring)' as val
AutoGenerate 1;

for each tab in FieldValueList('tablenames')

some script here

next tab

exit Script;

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