Valuelist with custom values which need to display the | chr

Discuss all problems you have with Servoy here. It might help to mention the Servoy version and Operating System version you are using

Valuelist with custom values which need to display the | chr

Postby rossent » Fri Jan 10, 2014 11:41 am

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?
Rossen Totev
Argos Software
rossent
 
Posts: 288
Joined: Wed Dec 31, 2008 2:03 pm

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

Postby mboegem » Fri Jan 10, 2014 2:00 pm

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
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1752
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

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

Postby rossent » Fri Jan 10, 2014 3:40 pm

Thanks Marc,

That does work!

I still think that there should be a way to do this directly in the Valuelist editor...
Rossen Totev
Argos Software
rossent
 
Posts: 288
Joined: Wed Dec 31, 2008 2:03 pm

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

Postby Providence1 » Thu Mar 06, 2014 2:42 am

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
Providence
Providence1
 
Posts: 456
Joined: Tue Aug 17, 2004 2:36 am
Location: New York, NY


Return to Discuss possible Issues and Bugs

Who is online

Users browsing this forum: No registered users and 29 guests

cron