Hello, I have a problem retrieving the chosen value of a value list (the value displayed) if that value returns an ID. Does anyone have an idea on how to accomplish this?
My problem is, that in my situation, I don’t know which relation to follow for the retieval of the name value. I just have a field with a value list that shows the name but delivers the id and I see no way to retrieve the displayed value via a method without knowing the relationship and the target field. Something like elements.xy.getDisplayValue() would be a big help…
Haven’t you defined your valuelist first?!?
When doing that, you must know the relation, right?
If you work with a custom Valuelist, I guess you would have to hardcode the different translations in you method…
Paul
I don’t know anything about the value list except for it’s name… We are in a dynamic environment ![Wink :wink:]()
even if I knew its definition, I might not even have access to that relationship from the table I am in… All I have is a field with whatever value list (this is dynamically set). All I want is to get the display value of that field, since the field contains only an ID.
what are you planning to do with a display value?
my problem is that I want to have access to what the user sees when choosing an item from a value list (the display value, not the value stored in the dataprovider). I need this to show what the user is searching for.
If you search for example for a country, you want to see France and not 426 (or whatever). I need to search for 426 though…
why do you want to see it?
do you want to display it again somehow??
I try to explain in detail: I am building my own search “engine”, since my users 1. need to be able to save their searches and 2. not everywhere in my UI you can access the fields needed for searching.
To be able to do this, I have created my own “dictionary” of the tables and fields available. Some of the fields have a value list attached when you enter data. Some of those value lists deliver an ID but show a text value.
When you enter a search your input is stored in one single field (“search_value”). Depending on the field you search, the search field shows the correct value list for that field (that value list is built dynamically based on a description logic that I store for every field that has a value list). So I don’t know anything about that value list except for how to build it.
Now, when the user chooses a value from a value list that delivers an ID, he sees the display value but the ID is stored in the search field. When the user now looks at all the criteria he entered he sees the ID but not the value itself.
My problem is, that I want to be able to present the user the display value that he has chosen from a value list and not the ID. But since I have no idea which relationship etc. is used, I cannot follow the relationship to grab that value. But the value is displayed if the correct value list is set, so everything is nice except for I cannot retrieve that value.
That is the reason I was requesting a getDisplayValue. Once the user chooses a value from the value list, I can use that with onDataChange to retrieve the display value and store that to show the user what he is searching for.
Does this make sense?
ok so you just want to redisplay the search criteria on a label of something?
Just attach the same valuelist to that label as you use in the search box.
or is this not possible?
I want to display that value in a field that shows the user what he searched for (the actual search field contains an ID…). I can’t attach a value list, because the whole search consists of several records (the single criteria) that I show in a tab panel…