Question
· May 25, 2016

Runtime Expressions in XML

Hi.

 

I'm facing a problem when I try to use the Runtime Expression below inside the XData Contents:

<html>#($$$Text("Testing!"))#</html>

It compiles correctly, but when I open the page on the browser I get the message "Expression Error" instead of "Testing!".

 

How could I use the $$$Text macro with Runtime Expressions? Is there a way to make this?

 

Thanks!

Discussion (5)0
Log in or sign up to continue

Actually, XData content it is a just XML, in it is stored exactly as you wrote it in IDE. But it is possible to compile any XData to any other format as you need, at this portal you can find two articles about how to do it, first and second. In your case it could be much easier, like some method which in compile mode gets all XData content and place it to &html<>, which then compile again as usual, and what you need after it is just call this generated method, to show this html. 

You cannot use macros in Zen runtime expression this documentation chapter covers runtime expressions:

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

If this question is actually about localizing text in Zen, please take a look at this documentation chapter:

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

Localize your text in %OnGetJSResources() and load it on the client-side via zenText(id).

The <html> component does not handle localization for you out of the box, as you can inject arbitrary HTML into it.

Most of the other components do localize their captions and titles automatically if you set the DOMAIN parameter in your Zen page. A button component automatically creates a dictionary entry for its caption property, e.g.:

<button caption="Save"/>