Colums with same name on a 4GL form
Posted in 2000
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL, Jobs, Consulting & Announcements
I want to use two columns from different tables but with the same column name on a 4GL form but am having problems. I have given the tags on the form the same name as in the tables ie f1 = orders.description f2 = customers.description I then have a global record with the following format DEFINE gr_custsum RECORD description LIKE orders.description c_description LIKE customers.description I want to do a constuct statement on these two fields. How do I do it? CONSTRUCT BY NAME q_item ON orders.description, customers.description does not allow me to tab to the second field in the form (I presume the field definitions on the form think I have only one field, description but the compiler won't let me re-name them anything else). however DISPLAY gr_custsum.description to orders.description gr_custsum.c_description to customers.description does display the information in the correct fields. Any help would be much appreciated Sent via Deja.com http://www.deja.com/ Before you buy.
jons2000@my-deja.com wrote: > I want to use two columns from different tables > but with the same column name on a 4GL form but > am having problems. > I have given the tags on the form the same name > as in the tables > ie > f1 = orders.description > f2 = customers.description > > I then have a global record with the following > format > DEFINE gr_custsum RECORD > description LIKE orders.description > c_description LIKE > customers.description > > I want to do a constuct statement on these two > fields. How do I do it? > > CONSTRUCT BY NAME q_item ON orders.description, > customers.description CONSTRUCT BY NAME means "ignore table name qualifiers". Do not use it when you have duplicate column names in the column list: CONSTRUCT q_item ON orders.description, customers.description FROM orders.description, customers.description Note that the items in the FROM clause are screen fields; the ones in the ON clause are the names that will appear in the generated WHERE clause. > does not allow me to tab to the second field in > the form (I presume the field definitions on the > form think I have only one field, description but > the compiler won't let me re-name them anything > else). > > however > DISPLAY gr_custsum.description to > orders.description > gr_custsum.c_description to > customers.description > does display the information in the correct > fields. > Any help would be much appreciated As written, it doesn't compile of course. However, you get the correct data to the correct screen fields because you specify the screen fields completely. If you did DISPLAY BY NAME you would get similar problems to those you encounter with CONSTRUCT BY NAME. For whatever it is worth (not a lot), I don't code I4GL with BY NAME; I've got too many other ways of losing what little remains of my hair to want to spend my time sorting the problems out. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v1.00.PC1 -- see http://www.perl.com/CPAN #include <disclaimer.h>