# Valuelist with custom values which need to display the | chr

**URL:** <https://forum.servoy.com/t/valuelist-with-custom-values-which-need-to-display-the-chr/17722>\
**Category:** Classic Servoy\
**Created:** [January 10, 2014, 9:41am UTC](https://forum.servoy.com/t/valuelist-with-custom-values-which-need-to-display-the-chr/17722 "2014-01-10T09:41:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rossent](https://avatars.discourse-cdn.com/v4/letter/r/258eb7/32.png) [@rossent](https://forum.servoy.com/u/rossent)\
**Post date:** [January 10, 2014, 9:41am UTC](https://forum.servoy.com/t/valuelist-with-custom-values-which-need-to-display-the-chr/17722/1 "2014-01-10T09:41:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [January 10, 2014, 12:00pm UTC](https://forum.servoy.com/t/valuelist-with-custom-values-which-need-to-display-the-chr/17722/2 "2014-01-10T12:00:26Z")

</div>

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:

```auto
application.setValueListItems('Aan',['56|34','aa|bb'])

```

Hope this helps

---

<div class="post-metadata">

**Author:** ![rossent](https://avatars.discourse-cdn.com/v4/letter/r/258eb7/32.png) [@rossent](https://forum.servoy.com/u/rossent)\
**Post date:** [January 10, 2014, 1:40pm UTC](https://forum.servoy.com/t/valuelist-with-custom-values-which-need-to-display-the-chr/17722/3 "2014-01-10T13:40:50Z")

</div>

Thanks Marc,

That does work!

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

---

<div class="post-metadata">

**Author:** ![Providence1](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@Providence1](https://forum.servoy.com/u/Providence1)\
**Post date:** [March 6, 2014, 12:42am UTC](https://forum.servoy.com/t/valuelist-with-custom-values-which-need-to-display-the-chr/17722/4 "2014-03-06T00:42:46Z")

</div>

A couple of caveats:

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

```auto
['56|34','aa|bb']

```

I would do this:

```auto
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
