Auto-fill from more than one source field

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
rprevost
Veteran Member
Posts: 34
Joined: 2018-05-30 22:09

Auto-fill from more than one source field

Post by rprevost » 2019-08-04 20:52

Hello to you all,
Using AG 5.76

I have two tables: stage and superviseur
In superviseur table, the relevant four fields are: first_name, last_name, telephone and email
In stage table, the relevant fields are: supername, super_telephone, super_email

* supername (ID) is a lookup field which fetches the first_name+last_name in the supervisor table (this works properly)
** super_telephone and super_email are lookup fields auto-fill checked (this works properly)

Now, in the stage table there are also the following fields: cosupername, cosuper_telephone and cosuper_email
The superviseur table is a collection of people who can be at times supervisor or cosupervisor for any given stage

In the stage table, i added these fields: cosupername, cosuper_telephone and cosuper_email

* cosupername (ID) is a lookup field which fetches the first_name+last_name in the supervisor table (this works properly)
** cosuper_telephone and cosuper_email are lookup fields auto-fill checked (this does not work properly since it returns the super_telephone and the super_email instead of the cosuper_telephone and the cosuper_email)

For supername = table superviseur, field name and the advanced sql is:

Code: Select all

SELECT `superviseur`.`id`, IF(CHAR_LENGTH(`superviseur`.`nom`) || CHAR_LENGTH(`superviseur`.`prenom`), CONCAT_WS('', `superviseur`.`nom`, ', ', `superviseur`.`prenom`), '') FROM `superviseur` ORDER BY 2
For cosupername (ID) = table superviseur, field name and the advanced sql is exactly the same:

Code: Select all

SELECT `superviseur`.`id`, IF(CHAR_LENGTH(`superviseur`.`nom`) || CHAR_LENGTH(`superviseur`.`prenom`), CONCAT_WS('', `superviseur`.`nom`, ', ', `superviseur`.`prenom`), '') FROM `superviseur` ORDER BY 2
AppGini somehow understands the difference between the two and return the right name for the super as well as the cosuper.

However, AppGini does not retrieve the cosuper_telephone and cosuper_email but it shows the super_telephone and super_email for a given cosupername (ID)

My question is is there a way, by altering the advanced sql code or whatever to retrieve the right value?

Regards,

Post Reply