Subject How to access field when there are dupe field names
Author Eyal

I use an IB_Query to compare table rows to an external source and
insert rows that don't exists in the table. I generate the query in
code and provide separate SQLs for select and insert. Here is a
simplified version of those queries (the actual version is too long):

SELECT aaa.num,, ppp.num, ppp.mod_date
FROM aaa
JOIN ppp ON // ppp is a SP

INSERT INTO aaa VALUES (:id, :num, :name)

I read data from the external source, and use Locate to check if it's
already in the dataset. If not, I use the following code to insert the
new row (again simplified):

query['id']:=query.GeneratorValue('gen_aaa_id', 1);


1. When I looked at the resulting table I noticed that the 'num'
column was empty in all new rows . I was puzzled at first because I
explicitly set the value of the num field.

Then I realized that I have two fields named 'num', one from table
'aaa' and one from the SP 'ppp'. So I intended to set '' but
ended up setting ''.

How do I access the correct field when there are several fields with
the same name?

2. I tried to be clever and use the fully qualified name -
query['aaa.num']:=... only to discover that IBO ignores the table name
and only uses the field name.

Is this a bug or an intended behavior? Is there any way to access
fields using the fully qualified name?

A possible solution is to use aliases for all fields, but this makes
query building very cumbersome, and really pointless as "table name +
field name" already provides a unique identifier.