Page 1 of 1
Lookup field in Browse and reports
Posted: Wed Aug 24, 2022 1:02 pm
by ivan

Hi I have created a lookup field that works OK in an edit form but in the browse form it just shows random numbers also this is the case in the report i created.
Can anyone assist please.
Re: Lookup field in Browse and reports
Posted: Wed Aug 24, 2022 1:25 pm
by kev1n
HI,
Hi, you will need to use a SQL JOIN in the Browse SQL to retrieve the description/name and display it instead of the id.
This "random number" is the primary key.
Check out
https://github.com/nuBuilder/nuBuilder-4.5/issues/28
Re: Lookup field in Browse and reports
Posted: Wed Aug 24, 2022 4:15 pm
by ivan
Many thanks for your reply, unfortunately I still cant get it to work. I have noticed that id field and lookup field both only contain numbers and letters in the database. I did an export of the table which I hope I have attached.
Where you say do a JOIN to display the description I'm not sure what you mean.
Sorry but I am new to this so struggling a bit.
Re: Lookup field in Browse and reports
Posted: Wed Aug 24, 2022 4:28 pm
by kev1n
What does your Browse SQL Look like?
Re: Lookup field in Browse and reports
Posted: Wed Aug 24, 2022 5:22 pm
by ivan
Hope this is helpfull
SELECT
lookup_test.lookup_test_id,
lookup_test.lookup
FROM
lookup_test
LEFT JOIN mftr ON Lookup.lookup_test_id = Manufacturer
Re: Lookup field in Browse and reports
Posted: Wed Aug 24, 2022 5:24 pm
by ivan
When I put the join statement in, no records are displayed. I have tried varies ways but no joy.
Thank you for your help, don't want to be a pain.
Re: Lookup field in Browse and reports
Posted: Wed Aug 24, 2022 6:17 pm
by kev1n
Inspect the generated Browse SQL by pressing ctrl+shift+m and run it in phpMyAdmin. In this way it's easier to see where there is a mistake.