Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Xolink1389
Creator
Creator

HOW LOAD ONLY TABLE STRUCTURE and NO RELATION?

Hello community

i made a post aksing for help to load and empty table, at the end i could find a solution, using a where 1=2 on the consult,

but the problem its that im trying to load field from TABLES in SAT DATA BASE, so

i desing this, in order to load this tables, but as i understand qlik always look in the record on the tables, that means if i say 1=2 i know this is false and the result will be none data, but qlik dont understand that way, making this consult take like 30 min or more to load only empty fields, so i wanna know if there is a way to load the empty field, by telling qlik bring ONLY THE FIELD AND DONT LOOK IN THE RECORDS or always will be that way? cuase i really need load like 40 Tables and we are talking about like tables that contains records from many many year, you will say add a filter in the field of years, the problems is that the field year can be called in diferent ways in diferent tables, and some other dont have that field, so finally im thinking in something simple, JUST BRING THE FIELDS AND NO DATA. Is that posible? one more thing i know qlik make relation and i try to cancel this with a no concatenate but it dont work is there a way to cancel the relation beside the Qualify sentence?

 

 

Set vTablas1 = 'MARD','MBEW','MSEG','T001','T001L','T001W';
set vfield = 'BURKS', 'WERKS';
FOR  each i in $(vTablas1)  
 let WhereClause = '1';
	for each j in $(vfield)
    let fieldexist = FieldNumber('$(j)','$(i)');
    if $(fieldexist) > 0 then
		LET FieldValue = IF('$(j)' = 'BURKS', '1000', '1081');
        LET WhereClause = '$(WhereClause) AND $(j) = "$(FieldValue)"';
        End If;
        next j;
  Qualify*;      
    '$(i)':
    LOAD 
    * ;
    SQL SELECT * FROM $(i) where 1=0;
NEXT i

 

 

 

Labels (5)
1 Reply
marcus_sommer

It's not quite clear for me what you are want to do?

Especially by larger data-sets it's important to apply the conditions within the sql-part because doing it on the Qlik side would mean to pull at first all data and then filtering them.

I don't know if sql supports to ability to load only the header of a table but by using some TOP / FIRST / LIMIT or similar statement to the query a limiting to 1 record would be possible. But better as loading all available fields and then looping through them would be to query this directly in the data-base against the system-tables. Those results might be then mapped with lists of the wanted target-fields and also how they should be finally named which ends in a complete sql-statement including any where-clauses.

Further skip the attempt to apply any qualifying - you won't need it on the Qlik side.