A few questions about "Invalid key" on view property

Running Version 8.1.48

Hi Ignition Masters,

I know it's been talked about a lot here (I did my homework before posting this). But I have a few questions about view property "Invalid key" warnings that appear when binding a property to a memory (document) tag that has keys with spaces, leading numbers, etc.

1- Those warnings/errors seem harmless, as my references work without issues regardless. So, what are the downsides if I ignore them?

2- Is there a "best practice" or a recommended workaround when dealing with this issue in Perspective? Provided that "sanitization" (e.g. _1388_RH_CELL) is not an option as those exact cell names are used in dozens of different locations across the projects and the gateway. Referencing the tag directly seems to work flawlessly though but I'm concerned about having dozens of subscriptions to the same tag and the unnecessary overhead they may entail.

3- I know I can create a mapping (or keySanitize()/keyDesanitize() functions) but wouldn't that require a transform on every single property that references that data? I seem to have an allergic reaction to using transforms unless absolutely necessary (I know I probably view them to be way more costly than they really are, but I have a lot of old/low-end clients like TV browsers and tablets, so my concerns may be valid).
I'm currently using the neat, concise, single line expression binding from the previous screenshot, but at what cost?
image

Thank you in advance.

For the least amount of overhead, I would install Phil's Integration Toolkit and use mungeColumnName().
Expression-Scripting Connectors - Integration Toolkit for Ignition

The best practice is to not use tag names with spaces or that are otherwise not valid as identifiers. Then you won't get into this kind of pinch.

Though my toolkit can help.

2 Likes

not use tag names with spaces

Did you mean "key names" here? because my tag name (and path) has no spaces in it

Anyway, it'd be nice if someone can answer this for me:

1- Those warnings/errors seem harmless, as my references work without issues regardless. So, what are the downsides if I ignore them?

Both. Because it is natural for tag names to be used as key names in many cases.

The warnings are there because the result produces invalid JSON, which cannot be reliably transmitted to the client browser. If you marked that property as "private", then it won't go to the browser, and you can ignore those warnings.

I still maintain that spaces are perfectly fine within tag names - I've been using them for 10+ years now. The only issue I've ever come across is when I (mistakenly) tried to bind a prop to a UDT instance; the keys which hold the tag values then have spaces in them which are invalid. However I'm vehemently opposed to binding directly to a UDT instance, so that issue for me is moot :man_shrugging:

That's OK. I don't mind if you're wrong. People are wrong on the internet all the time. I can't slap them all down. :smirking_face:

6 Likes

Haha, I'm OK with being wrong this time :grin: