Question
Ruslan K · 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. 

00
6 0 26 363
Log in or sign up to continue

Replies

How should I place this html entity to string? 

If I do this way "House number, apartment", it is not working.

Taking a quick look at the Zen code, I can see that it does an HTML escape on the comma separated values with

$ZCVT(tHeader,"O","HTML")

The problem with that is...

House number, apartment

will turn into...

House number, apartment

which defeats the idea of using an escape for the comma, so no, this suggestion won't work for you

Because Zen is written in XML, "," in an attribute actually does get turned in to a comma in the generated code (see %CreatePage in the .INT code), and then is treated like a comma when the column headers are $piece'd out.

Unfortunately, &#65292 wouldn't work as it's passed through $ZCVT(tHeader,"O","HTML") which would result in...

columnHeaders="House number,apartment"


!   ", "  is seen just as another string text
You need the unicode character here to make it working

columnHeaders="house number"_$C(65292)_" appartment"

Try cutting and pasting this fullwidth comma into your code, looks similar...

 >>>  ,<<<

 

Is not working. If I put this  >>>  ,<<<  to string, and my string looks like "Number >>>  ,<<< apartment", then in dropdown

header there is only first part till space -  Number >>>

I think, it is impossibe to escape comma in dataCombo columnHeaders. I tried a lot of variants, and nothing

Don't cut and paste the arrows as well, just the comma, the arrows were just to make the comma stand out in the post, so just cut...

 ,

No, is not working. This comma break string. 

DropDown column header breaks on this comma. There is only text till your comma - "Number " 

USER>set string="A,B,C,D,House number,aparment,E,F,G,H"
 
USER>for i=1:1:$l(string,",") w !,$piece(string,",",i)
 
A
B
C
D
House number,aparment
E
F
G
H

Are you running a Unicode version of Caché? If you're not sure, post your $ZVERSION string here.

My version is - Cache for Windows (x86-64) 2017.1 (Build 792) Mon Mar 20 2017 19:36:11 EDT

I am running 8-bit version, not UNICODE. My old bases in 8-bit encoding.

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

columnHeaders="House number&#65292;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!

Why did not Intersystems implement such behavior in dataCombo.columnHeaders like in combobox.displayList?

In combobox.displayList we can escape comma "\," and it wirks fine.

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.

&#65292;

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.

I tried, in browser it doesn't work.

Browser outputs it as - &amp;#65292; if I use ZConvert("... &#65292; ...", "O", "HTML") 

and "as is" if I use plane string - "... &#65292; ..."

Nothing works.

I have refused of idea to use comma in columnHeaders string. I will be use dash sigh like "House - apartment".

Some of us actually do;) (work at ISC). Feel free to open a WRC ticket and ask for an enhancement for this.
Best,
Fab


!   "&#65292; "  is seen just as another string text
You need the unicode character here to make it working

columnHeaders="house number"_$C(65292)_" appartment"


sorry, was in the wrong context before

Per the OP's comment here, in this case it's an 8-bit Caché instance, so Unicode characters aren't available on the server.

That's not actually the case. If you look at the .INT code for the generated %CreatePage method of a Zen page with &#65292; 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 &#44; 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.

LOL, this is why I don't do Zen!

Give me a client side framework such as Ext-JS every day of the week...

Per the OP's comment here, in this case it's an 8-bit Caché instance, so Unicode characters aren't available on the server.

Then that's the curse of $PIECE() with no chance to fake it.

So name the separator   # ' " . / \ ~ ^ ...anything but ,

[ as Johnny Cash was singing:  ... anything but "Sue" ]

Ultimately the columns are split out using $P(columnHeaders,",",n), so since there is no way to escape the, out of $P, there currently is no way to do that.