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: 
vkolasani
Contributor III
Contributor III

Building query builder based on table, column parameters with out building QVD

I have scenario to develop a query builder based on the database, table parameters.

For example:

vdatabasename, vTablename, vPrimarykey      etc and based on these inputs we should be able to develop something which should generate the simple queries.


select count(*) from vdatabasename.vtablename


select vprimarykey, count(*) from vdatabasename.vtablename group by vprimarykey having count(*)>1; etc

Goal Qlikview should accept the database, table, primary key etc parameters and generate the queries.

any inputs on this would be a great help!!!!

Thanks,
Venu
3 Replies
maxgro
MVP
MVP

maybe with a loop on a table

// CONNECT ....

d:

load * inline [

vdatabasename, vTablename, vPrimarykey

db1, tb1, pk1

db2, tb2, pk2

db3, tb3, pk3

];

FOR i=0 TO NoOfRows('d') -1

  LET vdb=Peek('vdatabasename', $(i), 'd' );

  LET vtb=Peek('vTablename', $(i), 'd' );

  TRACE $(vdb);

  SET vsql1 = select count(*) from $(vdb).$(vtb) ;

  TRACE $(vsql1);

  SQL $(vsql1) ;

NEXT

vkolasani
Contributor III
Contributor III
Author

Thank you Grossi!!

I will test and let you know.

Thanks,

Venu

vkolasani
Contributor III
Contributor III
Author

Thanks you Grossi! I was able to achieve the desired functionality with few modifications.