Page 1 of 1

Lookup field shows data from another field

Posted: 2021-04-29 18:57
by dlee
I have a table named employees that has a field named dept. I set the employees.dept field to link with the departments.name field. Instead of showing the department name it is showing the department.id field data. I hope this is clear enough for you guys to help.

Employees:
id
name
dept

Department:
id
name

Thanks,TD

Re: Lookup field shows data from another field

Posted: 2021-04-29 19:19
by jsetzer
In employees.dept double check lookup options. Especially check value of caption 1.

Can you please upload a screenshot of the field settings of employees.dept

Note that the primary key (id) will be stored in database. The field(s) you define as caption are just for display. The primary key defines the relation between those two records.

I recommend naming such lookup fields dept_id which gives more flexibility for future autofill fields like dept_description etc.. but this is just my personal opinion and experience.

Re: Lookup field shows data from another field

Posted: 2021-04-30 02:00
by dlee
Thank you jsetzer for helping. This is my first full app I have built with Appgini so I probably have something wrong. The attached screen capture shows how I have things configured in Appgini. Please review and advise on how to properly link tables within Appgini

TD

https://adsi-sc.com/accommodations/imag ... apture.jpg

Re: Lookup field shows data from another field

Posted: 2021-04-30 06:40
by jsetzer
Everything looks fine. Did you re-generate all files and upload all necessary files to your webserver?

Re: Lookup field shows data from another field

Posted: 2021-04-30 16:07
by dlee
Hi jsetzer, I just finished uploading everything to the web server. I have tried everything I know to do including deleting the employees table in Appgini and then recreating it again; same issue. This is the only place in the app where this occurs so I have decided for now to just live with it although I might ask tech support to look at it. Anyways, thank you for your help!
TD

Re: Lookup field shows data from another field

Posted: 2021-05-03 22:18
by pfrumkin
Hi,

A shot in the dark:
Is there anything funny in the Advanced section for the employees.dept lookup field? It should be something like

Code: Select all

SELECT `departments`.`id`, `departments`.`name` FROM `departments` ORDER BY 2
~Paul

Re: Lookup field shows data from another field

Posted: 2021-05-05 01:43
by dlee
I just checked the Advanced section for employees.dept and it had exactly the same thing you posted so no joy there, but thanks for trying to help
TD

Re: Lookup field shows data from another field

Posted: 2021-05-05 05:55
by pbottcher
Hi,

just a short question. Is this a single lookup you are using, or is this somehow a nested lookup? There is an issue with nested lookup not showing the data, but the id.