Reputation: 922
I am using apex to build a interactive report. My report content is based on two tables where table A contains an id, and I need to get the corresponding name for that id in another table B.(Actually there are four ids that need to be replaced by names in other tables but for simplicity, let's just assume that there are only two tables).
Now update page is set to fetch rows from table A automatically so that the page is displaying the id from table A. However, I want to show, in the update page, the name instead of id but when you submit the page it is the id that is submitted.
Is that possible to create a function in Apex that convert the id to name and show the name on page but when you submit the page it is the id that is actually submitted? If so, how can I achieve this? Or is there any other way to achieve what I want?
Upvotes: 1
Views: 829
Reputation: 7028
Several items have this inherent capability of displaying a display value while retaining the id.
A select list for example accepts a list-of-values which has both a display and return column. There are also popup-lovs, or lov plugins which handle the same.
The source of these items will have to be an ID, and when you reference the item, you'll also get an ID back.
For a report you will likely be joining tables together in order to display everything (you can apply LOVs on columns, but I wouldn't advise it: I prefer having control over my query). In forms you'll need this type of item to translate things for you.
For your columns with IDs:
- use type select list
- specify the LOV, eg select name, id from table_b order by 1
- as source, use what provides the ID. If you have a fetch row process on table A which has the IDs, you can leave things like that: an ID will be used and it will be translated at the front end to the display value (roughly put)
Upvotes: 1