Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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,
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;
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;
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;