application.getValueListDisplayValue() issue

I have problems retrieving a value by perfoming application.getValueListDisplayValue()

For example:
Content of valuelist ‘rel_correspondence_type’:
i18n:label.letter|1
i18n:label.email|2
i18n:label.mailing|3

The valuelist is submitted to the field ‘correspondence_type’.

correspondence_type = 3

Retrieve data:
var vValue = application.getValueListDisplayValue(‘rel_correspondence_type’, correspondence_type)

vValue gets null as result.

Am I doing somthing wrong here?

Not sure but what if you add “3” instead of 3.

I guess the valuelists is formatted as a String. Adding 3 will format to 3.0.

Again, wild guessing but I would not be surprised if this is it.

(BTW you can also do 3 + “”).

Hope this helps

Seems to work for me.
What version of Servoy are you using ?
I am using Servoy 3.1.6.

I tested it. “3” or 3.0 or 3 all work.

Another guess, when it does not work, is the i18n label defined?

ROCLASI:
Seems to work for me.
What version of Servoy are you using ?
I am using Servoy 3.1.6.

Hi Robert, I’m using 3.1.6. too

IT2Be:
Not sure but what if you add “3” instead of 3.
I guess the valuelists is formatted as a String. Adding 3 will format to 3.0.
Again, wild guessing but I would not be surprised if this is it.
(BTW you can also do 3 + “”).
Hope this helps

The dataprovider is an INTEGER, so that would return a 3, wouldn’t it?

IT2Be:
Another guess, when it does not work, is the i18n label defined?

Yes, the i18n labels do work fine. The valuelist is displaying the labels correctly on the form.

Hi Karel,

Can you check if correspondence_type indeed holds that value.
Like with application.output(correspondence_type)

Also when you use a value higher then the valuelist is long you end up with a null as well.

Hope this helps.

ROCLASI:
Hi Karel,
Can you check if correspondence_type indeed holds that value.
Like with application.output(correspondence_type)

This returns 3
But when I try an Evaluate:
application.getValueListDisplayValue(‘rel_correspondence_type’, 3)
I get nothing as result. :?

Also when you use a value higher then the valuelist is long you end up with a null as well.

That’s not possible here. The user selects the value by combobox.
I use application.getValueListDisplayValue(‘rel_correspondence_type’, correspondence_type) only to set the selected value in a title bar.
So what on earth could be wrong here?

Servoy Developer
Version 3.1.6-build 410
Java version 1.6.0_01-b06 (Windows XP)

This is where it goes wrong:
if I attach the valuelist to a field on the form where I do application.getValueListDisplayValue() , the function doesn’t work.
If the valuelist is removed from the field, the function works again.

Maybe something with escaped codes or something like that?

I experienced something funny in that area as well yesterday.
So I would not be surprised if you, accidentally, hit some sort of key combination while you were doing something wild :)

Karel and I already found it.
When a valuelist is used on the field on the form then the function doesn’t work. :?: :!:

I guess some more testing is required to narrow it down some more.

IT2Be:
Maybe something with escaped codes or something like that?

I experienced something funny in that area as well yesterday.
So I would not be surprised if you, accidentally, hit some sort of key combination while you were doing something wild :)

I’m ALLWAYS doing wild stuff with Servoy 8)

huh.

what if you do the same from 2 different forms?

Are you trying to retrieve the info on show of the form while you setup the valuelist or are these two really different operations.

Very strange…