It's all about the answers!

Ask a question

If save in a variable and display it in the report, the data looses formatting


Dmitry A. Lesin (23413065) | asked Dec 26 '19, 2:09 p.m.

Hello!

I'm trying to build a report using next schema:

https://<SERVER_URI>/rm/publish/views?metadata=schema

When I iterate fields in some view, it displays correctly formatted data with <div> element of schema in "Text" element of RPE. But if I will save <div> in JavaScript variable first (for example, trying to save artifact names in an array), and next if I display it in "Text" element, then it will show the artifact's data without any formatting.
I can not understand why the formatting is lost if I use a JavaScript variable to save it.
On the next screenshot, there's part 1 that directly displays <div> elements, and section 2 that displays the same data but preliminary saved in an array:

Some explanation

Could please somebody explain why the formatting is lost in this way?
Thank you very much for help!

Accepted answer


permanent link
Bartosz Chrabski (2.5k11936) | answered Jan 07, 3:46 a.m.
Dimitry,

When you assign value to text or to variable please check if you have both value selected for XHTML Input and XHTML Output.

If none of them is selected You will get plain text without any html tags.

I do not have access to my RPE instance to provide screenshots but following post should be helpful.


Hope it will help You.
Dmitry A. Lesin selected this answer as the correct answer

Comments
Dmitry A. Lesin commented Jan 07, 6:46 a.m.

Hi Bartosz,

Thank you very much! It actually works. If more detailed, then we need to set XHTML input when saving the data into a variable:

Set XHTML input first

And when we print the value in variable, we need to set XHTML output:

Set XHTML output

In this way, the resulted content will be formatted:

Formatted result

Many thanks!!!

Your answer


Register or to post your answer.