-
[Answers] Picklist Lookup
Q:
how to implement a picklist for a FK field in a table inside a form and grid section.
A:
Use the Choices attribute and specify a SQL Select statement. For numeric fields, use the Choices + Get data mapping / Set data mapping as demonstrated in the example_datamapping App.
Taking the southwind orders table as an example, it contains the customerid field, e.g. 'ALFKI'. For that, I would just use choices - select customerid from customers - and include an 'order by' or 'where' clause if required. The orders table also has employeeid. If I wanted to display the lastname of the employee, rather than their id, I would use data mapping to display the lastname (Get data mapping) and my select statement would be based on the lastname. I would use the Set data mapping to store the employeeid for the selected lastname back to the table.
So if you just want to display a choice list, just use choices and if you want to display a name or a description associated with an id (another field in the lookup table), use the get/set data mapping as well.
All topics in [Answers] alphabetically:http://www.lianja.com/community/show...ll=1#post12352
Last edited by josipradnik; 2017-01-04 at 03:01.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks