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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter records to show in a form

Status
Not open for further replies.

helpmonny

Technical User
Feb 25, 2002
21
0
0
GB
I have already created a form which shows all records from a table. How do I change this to only show a subset of records e.g. where ref matches "SFP*" so the user doesn't have to filter themselves everytime as they are only interested in this subset of records.
 
Hi:

It depends on how you are binding the records in the table to the form. To readily allow the user to enter filter criteria requires using the Informix 4GL CONSTRUCT verb.

Consider this code stub:


OPEN FORM find_user from "frm/find_user"
DISPLAY FORM find_user

DEFINE query_1 CHAR(300),
MESSAGE "Enter search criteria."

LET int_flag = FALSE
CONSTRUCT query_1 ON
user_id
FROM
user_id

IF query_1 IS NULL OR
query_1 = " "
THEN
LET query_1 = "1=1"
END IF END CONSTRUCT

LET s1 = "SELECT * FROM o_timetrack WHERE ", query_1 CLIPPED

PREPARE sel1 FROM s1
DECLARE c_node SCROLL CURSOR FOR sel1
# End Stub

The find_user screen has only one column - user_id.

Let me know if you have any questions,

Regards,


Ed

 
Hi Ed, thanks for you reply. This doesn't resemble my code so it's maybe a different version. This is my code for a basic form and I want to filter the [f000]field automatically:

database sfp
screen size 24 by 80
{
File Reference [f000 ] Enquiry Date [f001 ]
Summary App Recd [f002 ]
Stage 1 Ref [f100 ]
Summary App Response [f003 ]
Project Title [f031 ]
Organisation [f004 ]
Organisation Status [f018 ]
Address [f009 ]
[f010 ]
[f011 ]
[f012 ]
[f013 ]
[f014 ]
[f015 ]
[f016 ]
Status [f029 ]
Likely to Compete [a3 ] Eligible [a0 ]
Scheme [a1 ] Area [a2 ]
}
end
tables
sfp_enq
attributes
f030 = sfp_enq.our_ref;
f000 = sfp_enq.our_ref2;
f001 = sfp_enq.enq_date;
f002 = sfp_enq.sumapp_date;
f100 = sfp_enq.count1;
f003 = sfp_enq.sumapp_resp;
f031 = sfp_enq.project_name;
f004 = sfp_enq.org[1,60];
f018 = sfp_enq.org_status;
f009 = sfp_enq.add1;
f010 = sfp_enq.add2;
f011 = sfp_enq.add3;
f012 = sfp_enq.add4;
f013 = sfp_enq.add5;
f014 = sfp_enq.add6;
f015 = sfp_enq.add7;
f016 = sfp_enq.postcode;
f029 = sfp_enq.app_stat[1,60];
a3 = sfp_enq.compete;
a0 = sfp_enq.eligible;
a1 = sfp_enq.scheme;
a2 = sfp_enq.area;
end
 
>This doesn't resemble my code so it's maybe a different version.

A different version of what? I need more information.

Since this is an Informix 4GL forum, I assumed that you are executing your form from an Informix 4GL program. Is this correct?

Perhaps you are executing from only from isql?

Regards,

Ed
 
Sorry Ed, you are right. I'll find the correct forum. Sorry for wasting your time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top