%Save() is not saving data into cache DB.
I have created below Add method in REST api, I got requested data in objExternalUser object but it is not saved to DB.
Using "Write objExternalUser.%JSONExport()" I got JSON data.
Please refer below screen.
Hi @Vivek Nayak!
Always check the status of %Save - it could result in an error. And I think this what was happened in your case.
90% of my "it doesn't save" with %Save caused by MAXLEN of %String property. %String property goes with MAXLEN=50 by default and it's often not enough. Check you have a such ;)
As I see in your code you already do some "error handling". So you can continue:
Change your code
to the following:
HTH.
Out of curiosity - you have empty Try-Catch block. Why don't use it?
you could embrace your code into the following:
And catch your error with status in catch then.
Use %VarString instead of %String - it has default length of 3 641 144 characters.
And no "side effects"? )
Not that I know of.
If you're sure about MAXLEN it's better to specify it explicitly of course, but if you have no idea %VarString is a nice solution.
I agree. I don't know the reasons which caused to limit the MAXLEN to 50 characters...
It steals months (if not more) of developers time to find out what was the bug and why this doesn't work because of MAXLEN=50;
Hi Vivek,
%Save() is a function . So please assign it to one variable and check it. Surely it will work.
for ex: set jData=objExternalUser.%Save()
Thanks.
Social networks
InterSystems resources
To leave a comment or answer to post please log in
Please log in
To leave a post please log in