Re: Help with 4gl !!!
Posted in 1995
To me your problem seems so simple it hardly warants any example code. There may of course be other parts to your problem, that you have not described that makes it difficult. As you describe it a standard construct/fetch setup will get you the data you want from the bussiness table. A cursor can thereafter easily be used to fetch corresponding data from the customer table. Depending on what you want to achive it's probably even better to select all the data with one cursor. Something along these lines would do that: construct p_where ... bussiness table fields let p_statement = "select * from bussiness, customer where ", p_where clipped, " and bussiness.phone = customer.phone And then prepare/declare a cursor in the usual way. To show a pick-list I whould try to fetch two rows from the result set. Only if the second fetch returned a row, I would populate the pick-list and show it. In this way you avoide a count first, which may take a long time if the user queried on a non indexed field. With the above setup you may also include customer table fields in you construct statement to select from whatever table the user enters data for (including both tables). Nils.Myklebust@ccmail.telemax.no NM-data, Dalsbergstien 7, N-0170 Oslo, Norway My opinions are those of my company PS: If the above solves your problem I wouldn't let this hired firm program it. I would find another. John Cokos wrote: > > Hello all, > > I am having a BIG problem with 4gl. Our company hired a firm to do > some programmnig for us. We are being told that something we had > previously agreed upon is not possible and I would like a bit ov > clarification from the experts..... > > Given two tables: > 1. Customers which contains approx 1 Million records and is > indexed on the Telephone Field and > the Customer field and NOT on the Company Field > 2. Business which contains approx 50,000 records and IS indexed > on the Company field > > And the following information: > 1. Every Company in the Customer Table has a correspondong > record in the Business Table > 2. Every time a Business is appended to the Customer Table, the > appropriate info is duplicated > in the Business Table (Company, Contact Person, Phone#) > > Is it possible, via 4gl to accept as input a company name (allowing for > wildcards), use that to look up the contact person & phone Number in > the Business Table. If there are multiple matches, show a Pick-List. > When one > from this list is selected, use the Phone Number (From Business) to > search the Customer Table and display all of the fields from the > Customer Table ?? > > This does not seem to be too difficult in theory, yet we are being told > that the only solution is to place an index on the Conpany field in > Customer Table (Which Will Slow down many other programs) or to write > down the ph > one number it finds in Business Table and then type that into the > Customer Table (Too Many Seps for data entry) If anyone has an answer > and possibly some sample code to make this possible, I would greatly > appreciate it.