It's all about the answers!

Ask a question

RAM API RAMAsset.setDescription - how can we set multi-line Long Description in an asset via API?


Troy Klomp (856) | asked May 19 '14, 2:40 p.m.
We are trying to read a text file, and set the contents of that file as the Long Description in a RAM Asset via API calls. But, when we do this, all of the line endings are lost so that the Description contains one long line consisting of all lines concatenated together. We've done some testing, trying to pass strings containing "\n" or "\r\n", but are unable to get this working.

Is there some special syntax to use to insert line endings into the Long Description?


Here is what we have been trying..........

                String LongDesc = "Line1\nLine2\nLine3\n";
                System.out.println(LongDesc);
                asset.setDescription(LongDesc);

But, here is what the Description looks like in the asset after running this.........




Accepted answer


permanent link
Lin Lu (3063) | answered May 20 '14, 2:07 a.m.
JAZZ DEVELOPER
Hi,

long description in RAM is rich text. I think one could use html elements in description.

As to your case, try this one in your code:
asset.setDescription("<p>lin1</p><p>lin3</p><p>lin4</p>");

Thanks.
Troy Klomp selected this answer as the correct answer

Comments
Lin Lu commented May 20 '14, 2:13 a.m.
JAZZ DEVELOPER

comment hided the html element in my comment,  it should be:

asset.setDescription("lin1<br>line2<br>"); 


Troy Klomp commented May 20 '14, 1:02 p.m.

Thank you Lu! This does what we need at this point. It's good to know that we could put more html out there as well.


Your answer


Register or to post your answer.