cancel
Showing results for 
Search instead for 
Did you mean: 

Sending Query to query template

Former Member
0 Kudos

Hi,

is it possible to send query from Html page to query template. for example, i create query template as IDBC server and in fixed query mode without giving any query. just blank. in page generator i mapped with iCommand. Now i want to send query from javascript by using getQueryObject. how to send it?

-senthil

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You will be able to dynamically pass the entire SQL to the query template from the HTML page. Just have the [Param.1] in the FixedQuery and use setParam(1,'Your SQL Query') with the QueryObject.

var qObj=document.<<appletname>>.getQueryObject();

qObj.setParam(1,'select * from table');

Answers (2)

Answers (2)

jcgood25
Active Contributor
0 Kudos

Senthil,

As John indicated, using the built-in query parameter [Param.x] allows you to be very dynamic in your approach, but document.APPLET.getQueryObject().setQuery('SELECT....'); would be the same thing if you just wanted to pass in the whole fixed query statement.

I may be getting ahead of things, but I can't help but think you are heading down a bad development path by burying all of your queries in the client side script. You can use iCommand applets as recordset objects, but they will always be client sided, not server sided like ado recordsets in asp. I've seen far too many system integrator botched applications where the the body onload was used to trigger javascript that attempts to force queries into applets when they have not been initialized by the JRE. By nature Query Templates themselves can be filled with [Param.x]'s but trying to develop large amounts of application content where the select statements are assembled in client side javascript can lead to all sorts of supportability issues for the customer. Imagine a customer going to training, and understanding the basics of query templates, and then trying to reverse engineer your page with one query template called "SQLGeneric" and all of the logic buried in javascript. He/she opens the template and all they find is a FixedQuery with [Param.1] - can you envision their confusion? Then they look at the 1000 - 2000 lines of javascript that I've seen at times?

Can you provide the business case as to why you would not create a simpler query template minded approach, or would want to construct the queries this way?

Regards,

Jeremy

Former Member
0 Kudos

jeremy,

actually in my work i dont know from which table i am going to take values to display. it based upon the selection from drop down list. and tables created in run time. i formed query in script. so i need to have one common query template to send different queries. thats y i am searched for this.

thanks

-senthil

Former Member
0 Kudos

Hi senthil,

1.if there are no conditions in your query then you can pass the table name as parameter. in that case the query will be:

select * from [Param.1] .

then from javascript u can pass ur table name which is selected from the dropdown as param to this query.

Thanks&Regards

Gurunadh.

Former Member
0 Kudos

If you can't GET it then SET it.