Bug 432359 - In a table, it is not possible to specify a lookup query from the same table (alias doesn't matter)
Summary: In a table, it is not possible to specify a lookup query from the same table...
Status: REPORTED
Alias: None
Product: KEXI
Classification: Applications
Component: Tables (show other bugs)
Version: 3.2.0
Platform: Compiled Sources Microsoft Windows
: NOR grave
Target Milestone: ---
Assignee: Kexi Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-31 17:06 UTC by Antonio
Modified: 2021-01-31 17:42 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Antonio 2021-01-31 17:06:52 UTC
SUMMARY

A field in a table cannot be populated by a lookup query from the same table. 

STEPS TO REPRODUCE

1. Create new blank database my_db
2. Create new table an_actors as: 
    id_actor integer, PK, autoincrement
    tx_actor text
    tx_gender text
    id_father integer
    id_mother integer
3. Populate an_actors with 2 records: 
    tx_actor,   tx_gender
    '(unknown)' '(unknown)'
    'White'     'M'
    'Black'     'F'
4. Create new query qry_fathers from an_actors:
    id_actor AS id_father
    tx_actor AS tx_father
    WHERE tx_gender <> 'F'
5. Create new query qry_mothers from an_actors:
    id_actor AS id_mother
    tx_actor AS tx_mother
    WHERE tx_gender <> 'M'
6. Table and queries were tested OK.

7. Open table an_actors in design mode, opening field id_father Lookup column: 
    Record source: qry_fathers
    Bound column: id_actor
    Visible column: tx_actor

8. Switch from Lookup column to Properties, then Save table (without switching, Kexi crashes).

9. Open table an_actor in data mode, specifying id_father '(unknown)' for each tx_actor ('White', 'Black'), the save record.

10. Open again table an_actor but all records have tx_actor='(unknown)'.

OBSERVED RESULT
tx_actor is filled with the tx_value returned by the lookup query, and aliases seems to be useless.
It seems not possible to use a query from the same table, as a lookup table.

EXPECTED RESULT
tx_actor should remain untouched, while id_father and id_mother should return the tx_value selected in the lookup query.
If I add a field to be populated from a lookup query from a different table, the problem does not arise.

SOFTWARE/OS VERSIONS
Windows: 10 Home

ADDITIONAL INFORMATION
This problem is highly reproducible.
Comment 1 Jarosław Staniek 2021-01-31 17:42:01 UTC
Thank you for the report.