Page 1 of 1

Valuelist with custom values which need to display the | chr

PostPosted: Fri Jan 10, 2014 11:41 am
by rossent
Hi Servoy,

In several cases we need to have valuelists which have custom values, but the value contains the "|" character (the same one which is used to delimit the display from the real value). In our case we do not have separate display and real values.
Is there a way to "escape" the | character in the valuelists custom values so that it is actually displayed in the dropdown list and not treated as a delimiter between display and real value?
So far we tried several options like "||" and "\|" but these do not work. The available help documentation does not mention anything about how to escape this special character... OR perhaps this is a bug and we need to create a case for it?

Re: Valuelist with custom values which need to display the |

PostPosted: Fri Jan 10, 2014 2:00 pm
by mboegem
Hi Rossen,

maybe a bit of a workaround, but you can do this by setting the values with the application.setValueListItems function.

so:
set the custom values of the value list to empty (design time)
then, in a 'init_valuelist' function, do something like this:
Code: Select all
application.setValueListItems('Aan',['56|34','aa|bb'])


Hope this helps

Re: Valuelist with custom values which need to display the |

PostPosted: Fri Jan 10, 2014 3:40 pm
by rossent
Thanks Marc,

That does work!

I still think that there should be a way to do this directly in the Valuelist editor...

Re: Valuelist with custom values which need to display the |

PostPosted: Thu Mar 06, 2014 2:42 am
by Providence1
A couple of caveats:

This doesn't work. It still displays both values - the display value and return value:

Code: Select all
['56|34','aa|bb']


I would do this:

Code: Select all
application.setValueListItems('myValueListName',new Array('First Item','Second Item','Third Value'),new Array(1,2,3))


If you set the field you are attaching the valuelist to to a form variable, I would make sure the JSDoc Properties of the form variable is set to: ,variableType:4