First off the two lists hold different sets of data, however through some combining of variables in the get method eventually hold the same type of data. The end goal is to populate a drop down with both lists sorted together based on their names (description).
The basic is that there are TWO tables holding the type of data, but holding it so differently that it’s virtually impossible to write a good SQL statement to get it out. The end result is a “name” or “nameIndex” object.
Both have an indexcode, but that is not related to the opposing table, it IS related to what is stored in a third table that needs to be updated with this code. The codes will never match between tables (one is two characters long, the other 3 or more).
How do I combine these two lists into a dropdown for the user so that the value of the dropdown is the indexcode and the description displayed as the label?
Example:
<html:select property="name">
<html:optionsCollection name="nameList" label="nameDescription" value="nameCode" />
</html:select>
<html:select property="nameIndex">
<html:optionsCollection name="nameIndexList" label="nameIndexDescription" value="nameIndexId.nameCode" />
</html:select>
(note the “nameIndexId.nameCode” value) into this:
<html:select property="allNames">
<html:optionsCollection name="allNames" label="nameDescription" value="nameCode" />
</html:select>
While virtually impossible, it was not completely impossible. I created a view in SQL to pull both lists at once with the data I needed, here is my answer:
This will create a view which you cal pull like any normal table for values of ID, DISPLAY and TYPE. It’s probably not an often run into problem, but this is a good solution for anyone who runs into junk like this in the future when you can’t change the data structure.