Re: Can you do a QBE on formonly field
Posted in 1994
Topics: SQL Development & Query Writing, Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
On Sat, 25 Jun 1994, Jonathan Leffler wrote:
> >From: lgrieser@crash.cts.com (Liam Grieser)
> >Subject: Can you do a QBE on formonly field
> >Date: Fri, 24 Jun 1994 18:16:33 GMT
> >X-Informix-List-Id: <news.7350>
> >
> >Is it possible to perform a query by example on a formonly field?
>
> Yes. You can do:
>
> CONSTRUCT somestring ON
> A.Column01, A.Column02, A.Column03, B.Column04, C.Column05
> FROM s_query.*
>
> All the fields in the s_query.* screen record can be formonly fields,
> or they can be references to any table you like.
How do you retrieve s_query.*? How would it be defined? Is s_query a
replacement for FORMONLY?
What if I have the SAME field on the screen twice?
The first occurance of the field uses the table.fieldname identifier and the
second uses the formonly.fieldname identifier. Example:
Form Specification File
DATABASE yahoo
SCREEN
{
Party Number:[f001 ]
Subject:[f002 ]
[f002 ]
Recommendation:
[f003 ]
[f003 ]
[f003 ]
...
}
end
TABLES
party
ATTRIBUTES
f001 = party.party_no TYPE SMALLINT;
f002 = party.remarks TYPE TEXT, PROGRAM = "vi";
f003 = formonly.recommend TYPE LIKE party.remarks, PROGRAM = "vi";
INSTRUCTIONS
DELIMITERS " "
Table structure
party.party_no KEY
party.party_type KEY
party.remarks
I can easily DISPLAY both fields when I have control of the query (4GL) as
the party_type field tells me what type of remark it is (i.e.- 1 is
Subject, 2 is recommendation, etc.).
The problem occurs when I try to SELECT the appropriate fields
and retrieve them. As you show below the WHERE is filled in by the query.
> Typically, the SELECT statement ends up looking like:
>
> SELECT A.PkColumn
> FROM SomeTable A, SomeOtherTable B
> WHERE A.PkColumn = B.FkColumn
> AND ...>
> where the ... is what CONSTRUCT returns.
The problem:
LET s1 = "SELECT party.party_no, party.remarks, party.remarks ",
"FROM party WHERE ", constructed_query clipped
- How can I pull up both remarks from the same table.field?
Perhaps by the following?:
LET s1 = "SELECT party.party_no, party.remarks, party.remarks ",
"FROM party WHERE ", constructed_query clipped,
" AND party.party_type = 1 OR part.party_type = 2"
Is this a better explanation or am I just not understanding the solution
you are presenting? Any suggestions you may give me are gratefully appreciated!
Thanks,
Liam Grieser
lgrieser@cts.com