Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

vkolasani
New 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
MVP
MVP

Re: Hi Gurus,

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
New Contributor III

Re: Hi Gurus,

Thank you Grossi!!

I will test and let you know.

Thanks,

Venu

vkolasani
New Contributor III

Re: Hi Gurus,

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