Question
· Aug 22, 2017

Escape comma in dataCombo columnHeaders value

The dataCombo property columnHeaders is a comma-delimited list of column headers displayed in the dropdown list.

Comma is a delimiter.

But, if I want add comma to columh header, for instance "House number, apartment" - this is value for header of one column.

How can I escape comma in this case?

"House number\, apartment" - is not working. 

Discussion (26)4
Log in or sign up to continue

To expand on Sean's answer from the comment section, perhaps try the numeric character reference for the fullwidth comma:

columnHeaders="House number,apartment"

Another option would be to create a custom Zen component that extends %ZEN.Component.dataCombo and handles delimiters differently for the columnHeaders property. Unfortunately, this approach would require overriding %DrawDropDownContents, which is an enormous method and flagged as [Internal] - best avoided, in my opinion!

That's a good question, but since none of us commenting here work for InterSystems, we can only assume it was an oversight.

Did you try Timothy's suggestion below to use the following as the fullwidth comma escape, he tried it out and it works.

,

I personally don't use Zen, so can only make suggestions, and this is as far as my suggestions can go on working around this limitation.

That's not actually the case. If you look at the .INT code for the generated %CreatePage method of a Zen page with , in columnHeaders (I tested this out with ZENDemo.FormDemo in the SAMPLES namespace), you'll see something like:

Set dtCmb7.columnHeaders="House number,apartment"

The numeric character reference is converted to the Unicode character when the Zen XML is imported; the reason , doesn't work is that it's converted to a plain old comma, which is no different from just putting a comma in the XML in terms of what Zen does with it.