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

Need a fields information through loop in a table

Hi Everyone,

I have below requirement. we are having N no of tables . listed are below coming from a variable

vAllTables = 'Table_Dept_Employees','Table_Dept_Salary','Table_Dept_Products','Table_All_Employees','Table_All_Salary','Table_All_Products'

I want to list out tables where string "DEPT" is available. 

in Every Dept Table. There are 2 fields Dept Code & Dept Full Name. we want to show these two field information from every Dept table.

Can some one please help to resolve this issue

 

Thanks,

Satya

Labels (1)
1 Solution

Accepted Solutions
Andrei_Cusnir
Specialist
Specialist

Hello,

 

I am not 100% sure that I have understood the exact use case scenario, however I have some information that hopefully can help you get on the right path towards a resolution. 

 

You have mentioned that you have an variable with many table names and you want to find the ones that have the string "DEPT". If you are trying to find all the tables that have the string  "Dept" in them, then you can do the following in Data load editor:

 

Set vAllTables = 'Table_Dept_Employees','Table_Dept_Salary','Table_Dept_Products','Table_All_Employees','Table_All_Salary','Table_All_Products';

 

Trace Data: $(vAllTables);

 

Let vDeptTables = '';

 

for each table in $(vAllTables)
Trace Reading table: $(table);
   Let foundDEPT = WildMatch('$(table)', '*Dept*');
   Let vDeptTables = if($(foundDEPT) > 0, '$(vDeptTables)' & ',' & '$(table)', '$(vDeptTables)');
Next

 

Let vDeptTables = Right('$(vDeptTables)', Len('$(vDeptTables)')-1);

Trace Dept tables: $(vDeptTables);

 

This takes the input: 'Table_Dept_Employees','Table_Dept_Salary','Table_Dept_Products','Table_All_Employees','Table_All_Salary','Table_All_Products'

 

And gives the output: Table_Dept_Employees,Table_Dept_Salary,Table_Dept_Products

 

However, you have also mentioned that those tables have 2 specific fields: [Dept Code] and [Dept Full Name]. So perhaps you want to iterate through all the tables and see, which ones have the specific fields and then note down the table's name. In that case, you can modify the provided script and experiment with various functions and logic statements.

 

I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional information. However, if it has helped you resolve the issue, addressed your concerns or at least pointed you in the right direction, please mark it as Accepted Solution to give further visibility to other community members. 
 

 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂

View solution in original post

1 Reply
Andrei_Cusnir
Specialist
Specialist

Hello,

 

I am not 100% sure that I have understood the exact use case scenario, however I have some information that hopefully can help you get on the right path towards a resolution. 

 

You have mentioned that you have an variable with many table names and you want to find the ones that have the string "DEPT". If you are trying to find all the tables that have the string  "Dept" in them, then you can do the following in Data load editor:

 

Set vAllTables = 'Table_Dept_Employees','Table_Dept_Salary','Table_Dept_Products','Table_All_Employees','Table_All_Salary','Table_All_Products';

 

Trace Data: $(vAllTables);

 

Let vDeptTables = '';

 

for each table in $(vAllTables)
Trace Reading table: $(table);
   Let foundDEPT = WildMatch('$(table)', '*Dept*');
   Let vDeptTables = if($(foundDEPT) > 0, '$(vDeptTables)' & ',' & '$(table)', '$(vDeptTables)');
Next

 

Let vDeptTables = Right('$(vDeptTables)', Len('$(vDeptTables)')-1);

Trace Dept tables: $(vDeptTables);

 

This takes the input: 'Table_Dept_Employees','Table_Dept_Salary','Table_Dept_Products','Table_All_Employees','Table_All_Salary','Table_All_Products'

 

And gives the output: Table_Dept_Employees,Table_Dept_Salary,Table_Dept_Products

 

However, you have also mentioned that those tables have 2 specific fields: [Dept Code] and [Dept Full Name]. So perhaps you want to iterate through all the tables and see, which ones have the specific fields and then note down the table's name. In that case, you can modify the provided script and experiment with various functions and logic statements.

 

I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional information. However, if it has helped you resolve the issue, addressed your concerns or at least pointed you in the right direction, please mark it as Accepted Solution to give further visibility to other community members. 
 

 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂