This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
It's been a long time since I have done any LANSA work or posted here.
It's coming back, but I am having trouble getting a CLOB field to work with a PRIM_MD.Edit.
We have a table defined that contains a CLOB field to store a JSON object.
I am trying to create a UI that will allow us to edit that JSON in a PRIM_MD.Edit field, however when go to set the field, I get a "Expression (type CLOB ) is not compatible with expression (type unicode string)" error.
How do I get the contents from a PRIM_MD.Edit into a CLOB field so that I can save it?
There is a nice example on how to display a json file, is the web page called xDemoWebJsonViewer
you may want to use an approach similar to that if you are planning to edit json text...
jsonedit2.png (36.36 KiB) Viewed 13819 times
If you want to read the json content of a clob field and moved it to a edit value, I would do something like this.. just an idea, there maybe many different ways to do it:
Thanks Dino, I did not realize there was a JSON sample out there, will have to check it out.
I got it resolved, albeit not with a CLOB.
I was using a CLOB because I thought it was the only way to generate a VARCHAR(MAX). All of the STD_* text based fields where to small, I think STD_STRNG is 512. I created a new field (type String length 65535) and found that, that too generates a VARCHAR(MAX).
That size should be more than adequate to handle our needs and we don't have to worry about the other issues with CLOBs like dealing with Filenames, not being able to edit in VL Web, etc.