go to post Matjaz Murko · Nov 2, 2021 Hi. Tnx for your reply. I'm doing some research/testing with WebSocket to achieve wanted functionality. Regards, Matjaž
go to post Matjaz Murko · Oct 4, 2021 That's the way the proxy classes are functioning (caching). But in new Native API for IRIS there are no proxies, just class methods/functions are called from app and I think, it should be pretty the same as calling this methods/functions from terminal window.
go to post Matjaz Murko · Oct 3, 2021 Hi. As I've mentioned in previous post I'm using workaround, but I think it's a bug in API, because the same method works fine in terminal window without explicite set the objects to null (all used objects are released and consequently all locks are released also - expected behaviour in class with procedure block enabled). Regards,Matjaž
go to post Matjaz Murko · Oct 2, 2021 I'm setting all referenced instances to null in COS to release locks as workaround. But I'm not sure it is a bug or expected behaviour...
go to post Matjaz Murko · Sep 29, 2021 I'm not using IRISObjects, just ClassMethodString: PersonData = JsonSerializer.Deserialize<PersonDataClass>(App.Iris.ClassMethodString("API.Calls.Operative", "Checking", CardNo.Text)); if (PersonData != null) { if (!PersonData.IsValid) { SystemSounds.Exclamation.Play(); }
go to post Matjaz Murko · Sep 29, 2021 Hi.Tnx for reply.Regardless that I'm using ProcedureBlock, Native API calls to class methods do not put instances out of scope (and consequently do not release locks).Regards, Matjaž.
go to post Matjaz Murko · Sep 29, 2021 I do not know if it is important, but I'm using abstract class. And although I explicitly add ProcedureBlock to the class definition it doesn't help when I'm calling the method with Native API...
go to post Matjaz Murko · Sep 29, 2021 These are my findings:- class has ProcedureBlock enabled by default,- if I run the class method from terminal window, it behaves as a procedure block,- if I run it from IRIS Native API (C# app) then it behaves as non procedure block and I have to set person & checking instances to null to release the lock.
go to post Matjaz Murko · Sep 29, 2021 Hi. Tnx for your quick reply. Here is the class method: ClassMethod Checking(CardNo As %String) As %String [ Language = objectscript ]{Set person=##class(MasterData.Person).CardNoOpen(CardNo,4)Quit:person="" "null"Set checking=##class(Production.Checking).%New()Set checking.Person=personSet checking.Condition.Type=person.Condition.TypeSet checking.Condition.ValidBy=person.Condition.ValidBySet checking.ConditionIsValid=(person.Condition.ValidBy>=+$Horolog)Do checking.%Save()Set model=##class(API.Models.Operative.PersonGetData).%New()Set model.Ident=person.IdentSet model.FirstName=person.FirstNameSet model.LastName=person.LastNameSet model.Department=person.Department.NameSet model.IsValid=checking.ConditionIsValidIf ('checking.ConditionIsValid){Set person.Condition.Type="T"Set person.Condition.ValidBy=+$Horolog+6Do person.%Save()}Do model.%JSONExportToString(.json)Do ##class(MasterData.Person).%UnlockId(person.%Id())Quit json} I'm using now %UnlockId method instead of setting the object to null. Regards,Matjaž
go to post Matjaz Murko · Aug 20, 2021 Hi. I'm looking for an example on client side in C# (Xamarin)... Regards, Matjaž.
go to post Matjaz Murko · Aug 13, 2021 Hi. I want to use Native SDK for Java to call class methods. Regards, Matjaž
go to post Matjaz Murko · Aug 5, 2021 Hi. Try this: set RNumber="100" set RowResult=0,Power=1 for i=$LENGTH(RNumber):-1:1 { set RowResult = RowResult + ($EXTRACT(RNumber,i)* Power) set Power = Power * 2 } Regards, Matjaž
go to post Matjaz Murko · Jul 18, 2021 Hi. It means that you make for every property you want do get from IRIS a call to IRIS server? Regards, Matjaž
go to post Matjaz Murko · Jul 17, 2021 Bellow is modified Load method: ClassMethod Load(Ident As %String) As %String [ Language = objectscript ]{Set data=##class(User.Data).%OpenId(Ident)Quit:data="" "null" // OriginalSet model=##class(User.Model).%New()Set model.Ident=data.IdentDo model.PNG.CopyFrom(data.PNG)Do model.%JSONExportToString(.json) Set file=##class(%File).%New("C:\Tmp\1.txt") //Log the json stringDo file.Open("WSN")Do file.Write(json)Do file.Close() // WorkaroundSet model=##class(User.Model).%New()Set model.Ident=data.IdentDo model.%JSONExportToString(.json) // CHANGE in workaroundSet a={}.%FromJSON(json)Do a.%Set("PNG",data.PNG,"stream>base64")// Set file=##class(%File).%New("C:\Tmp\2.txt") //Log the json stringDo file.Open("WSN")Do file.Write(a.%ToJSON())Do file.Close() Quit json} Compare files 1.txt and 2.txt, they are different, but they should be equal. With string recorded in 2.txt c# app doesn't throw the exception.
go to post Matjaz Murko · Jul 17, 2021 Hi. I've tried already with method %JSONExportToStream but C# InterSystems.Data.IRISClient.ADO.IRIS native provider does not have method to return stream. And I checked the string length on server side and client (C#) side - they are the same. As I've already mentioned the workaround in method Load works fine, so the string length is not the problem. Pls check your e-mail for attached PNG. Regards, Matjaž.
go to post Matjaz Murko · Jul 17, 2021 If you let me know your e-mail I can send you the PNG file I'm using to reproduce the error...
go to post Matjaz Murko · Jul 17, 2021 Hi. I use the model class when I want to export some extra data (e.g properties from referenced objects) - model class attached is just a demo class to reproduce behaviour. I've also tried to export on origin class as you've suggested but the result is the same. If I open saved stream on server it looks as a valid PNG file. Maybe you should test with larger PNG file to reproduce the error, because it works also fine for me with smaller PNGs. About IdKey index it is my habit to add the Unique parameter, although it is unique by it self :)... I use a workaround in Load method which creates a valid Base64 string on output: Set data=##class(User.Data).%OpenId(Ident)Quit:data="" "null" Set model=##class(User.Model).%New()Set model.Ident=data.Ident Do model.%JSONExportToString(.json) Set jsonBase64={}.%FromJSON(json)Do jsonBase64.%Set("PNG",data.PNG,"stream>base64") Quit jsonBase64.%ToJSON() I did also some logging on strings created with original Load method and workaround and it shows many differences... And I did it on IRIS server to ensure no extra encoding/decoding is done. Viele Grüsse nach Wien. Matjaž
go to post Matjaz Murko · Jul 16, 2021 Hi. Tnx for reply. Classes: Class User.API [ Abstract ]{ ClassMethod Load(Ident As %String) As %String [ Language = objectscript ]{Set data=##class(User.Data).%OpenId(Ident)Quit:data="" "null" Set model=##class(User.Model).%New()Set model.Ident=data.IdentDo model.PNG.CopyFrom(data.PNG) Do model.%JSONExportToString(.json) Quit json} ClassMethod Save(Ident As %String, Data As %String) As %Status [ Language = objectscript ]{Set data=##class(User.Data).%OpenId(Ident)If (data=""){Set data=##class(User.Data).%New()Set data.Ident=Ident} Set model=##class(User.Model).%New()Do model.%JSONImport(Data) Do data.PNG.CopyFrom(model.PNG) Quit data.%Save()} Class User.Model Extends (%RegisteredObject, %JSON.Adaptor){ Property Ident As %String; Property PNG As %Stream.TmpBinary; } Class User.Data Extends %Persistent{ Property Ident As %String; Property PNG As %Stream.FileBinary; Index Ident On Ident [ IdKey, Unique ]; Storage Default{<Data name="DataDefaultData"><Value name="1"><Value>%%CLASSNAME</Value></Value><Value name="2"><Value>Ident</Value></Value><Value name="3"><Value>PNG</Value></Value></Data><DataLocation>^User.DataD</DataLocation><DefaultData>DataDefaultData</DefaultData><IdLocation>^User.DataD</IdLocation><IndexLocation>^User.DataI</IndexLocation><StreamLocation>^User.DataS</StreamLocation><Type>%Storage.Persistent</Type>} }