Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I-SQL forms recieve paramters ?

Status
Not open for further replies.

Capoerista

Programmer
Aug 13, 2002
44
GB
Hi All,

Does anyone know if it is possible to pass parameters to an ISQL (7.20.UE1) form to be used as a default value when doing a query ?

Thanks

Ade
 
I am not exactly sure if it is possible in ISQL but it is in Informix 4GL and Informix ESQL/C. I will give you an example of both, I doubt the the 4GL will work.

ESQL/C
The following code prepares a statement from a variable named demoquery. The text in the variable includes one ? placeholder. The prepared statement is associated with a cursor and, when the cursor is opened, the USING clause of the OPEN statement supplies a value for the place holder.

$char queryvalue [6];
$char demoquery [80];
$database stores5;
sprintf(demoquery, "%s %s",
"SELECT fname, lname FROM customer",
"WHERE lname > ? ");
$PREPARE quid FROM $demoquery;
$DECLARE democursor CURSOR FOR quid;
strcpy(queryvalue, "C");
$OPEN democursor USING $queryvalue;

One where the parameter are known

sprintf(redo_st, "%s; %s",
"DROP TABLE workt1",
"CREATE TABLE workt1 (wtk serial, wtv float)" );
$PREPARE redotable FROM redo_st;

The fisrt 3 are examples of a 4GL statement where different values will be inserted each time the statement is executed. The last one is when parameters are known.

PREPARE s3 FROM
"SELECT * FROM customer WHERE state MATCHES ?"

PREPARE in1 FROM
"INSERT INTO manufact VALUES (?,?,?)"

PREPARE update2 FROM
"UPDATE customer SET zipcode = ?"
"WHERE CURRENT OF zip_cursor"

DEFINE u_po LIKE orders.po_num
PROMPT "Enter p.o. number please: " FOR u_po
PREPARE sel_po FROM
"SELECT * FROM order ",
"WHERE po_num = '", u_po, "'"
DECLARE get_po CURSOR FOR sel_po




Dodge20
If it ain't broke, don't fix it.
 
I just re-read your question, and I think I misunderstood it. Can you clarify what you mean? Dodge20
If it ain't broke, don't fix it.
 
To try and clarify query I am trying to find out if I could do something like

sperform formname lognumber

and within the form use the lognumber parameter to be default when doing add/query.

Thanks

Ade
 
I am not sure if that is possible or not. I know that you can set defaults in the attributes section of a form. It would be something like

m12 = fbsp_survey.eggs, right, default = 0;

Am I close to understanding what you want? Dodge20
If it ain't broke, don't fix it.
 
Dodge20,

Thats the sort of thing I'm looking at but with default=$1 maybe ? I am trying to avoid having to re-write a bunch of forms in 4GL and having to code everything myself.


Thanks

Ade
 
This sounds like it should be "do-able" I have found a message forum that is much better for informix than this one. There are some Informix masters here, who I am sure can help you with your problem


It does take a day before you become a member, but I found this is worth it. They were able to answer the questions that weren't asnwered in this forum.

Dodge20
If it ain't broke, don't fix it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top