go to post Matjaz Murko · Jul 11, 2021 Hi. I have tried everything except Dictionary. Tnx, it works! Regards, Matjaž
go to post Matjaz Murko · Jul 10, 2021 ObjectScript class: Class Packing.MasterData.Label Extends (%Persistent, %JSON.Adaptor) { Property Department As %String; Property Ident As %String; Index LabelId On (Department, Ident) [ IdKey, Unique ]; Property Name As %String; Index Name On Name; Property Width As %Integer; Property Height As %Integer; Property DeclarationWidth As %Numeric; Property DeclarationHeight As %Numeric; Property ScriptTU As %Stream.FileBinary; Property ScriptContainer As %Stream.FileBinary; Property Status As %String(DISPLAYLIST = ",Aktivana,Neaktivna", VALUELIST = ",AC,NA") [ InitialExpression = "AC" ]; Property VarsXctsTU As array Of %String(MAXLEN = 500); Property VarsXctsContainer As array Of %String(MAXLEN = 500); Query List(Department As %String) As %SQLQuery(CONTAINID = 1) [ SqlProc ] { SELECT Ident,Name FROM Label WHERE Department=:Department ORDER BY Name } } C# class: private class SaveDataClass { public string Name {get; set;} public int Width { get; set; } public int Height { get; set; } public double DeclarationHeight { get; set; } public double DeclarationWidth { get; set; } public byte[] ScriptTU { get; set; } public byte[] ScriptContainer { get; set; } public Object VarsXctsTU { get; set; } public Object VarsXctsContainer { get; set; } } C# deserialize code: IRIS iris = IRIS.CreateIRIS(Program.Factory); SaveDataClass aa=JsonSerializer.Deserialize<SaveDataClass>(iris.ClassMethodString("Packing.API.Administration", "LabelGetData", Program.Department, ddcLabelId.Text)); iris.Close(); LabelGetData method: ClassMethod LabelGetData(Department As %String, Ident As %String) As %String [ Language = objectscript ] { Set label=##class(Packing.MasterData.Label).LabelIdOpen(Department, Ident) Quit:label="" "" Do label.%JSONExportToString(.json) Quit json } JSON: {"Ident":"CRO","Name":"HRVATSKI TEKST","VarsXctsTU":{"0":"..TechnicalProduct.Product.GTIN","1":"$Translate($ZDate(..UsefulBy,4,,2),\"/\",\".\")","2":"..Batch","3":"$FNUMBER(..CommercialWeight,\".\",3)","4":"..TechnicalProduct.Product.GTIN","5":"$TRANSLATE($JUSTIFY(..TechnicalProduct.Product.CUsInTU,2),\" \",0)","6":"$TRANSLATE($JUSTIFY($FNUMBER(..CommercialWeight*1000,,0),6),\" \",0)","7":"$EXTRACT($ZDate(..UsefulBy,8),3,*)","8":"..Batch","9":"$TRANSLATE($JUSTIFY(..%Id(),6),\" \",0)_$TRANSLATE($JUSTIFY(..TechnicalProduct.Ident,6),\" \",0)_$TRANSLATE($JUSTIFY(..TechnicalProduct.Product.CUsInTU,2),\" \",0)_$TRANSLATE($JUSTIFY($FNUMBER(..CommercialWeight*1000,,0),6),\" \",0)","10":"..TechnicalProduct.Ident","11":"\"001\"","12":"$SELECT(..TechnicalProduct.Product.Unit=\"KG\":$EXTRACT($TRANSLATE($JUSTIFY(..TechnicalProduct.EAN13TU,7),\" \",0),1,7)_$TRANSLATE($JUSTIFY($FNUMBER(..CommercialWeight*1000,,0),5),\" \",0),1:$EXTRACT($TRANSLATE($JUSTIFY(..TechnicalProduct.EAN13TU,12),\" \",0),1,12))","13":"$ZTime($ZTimeH($Piece(..CreatedAt,\" \",2),3),2)"}} Properties for which I'm looking for solution are VarsXctsTU and VarsXctsContainer. Both are of type "array of %String". In C# class these properties are now declared as type Object, but they should be something like List<KeyValuePair<string,string>>, shouldn't they?
go to post Matjaz Murko · Jul 4, 2021 Hi. I'll stick with first one. Tnx again. Regards, Matjaž P.S. Where are you comming from (you know word like "Zdravo" :) )?
go to post Matjaz Murko · Jul 4, 2021 Hi. It works although in the documentation stays: method %SerializeObject(ByRef serial As %Binary, partial As %Integer = 0) as %Status [ Language = objectscript ] This method retrieves all of the serial values for referenced objects and places them into the instance variables, Validates, Normalizes, and serializes the object (with a save of the persistent image if persistent).This method is not meant to be called directly. It is called by %Save and by %GetSwizzleObject. Tnx! Regards, Matjaž
go to post Matjaz Murko · Jul 3, 2021 Tnx for you answer, but I'm not sure I understand it. I don't have problem with index but with Open method: Set attributes=##class(Packing.Needs.Attributes).%New() //%SerializeObject Set attributes.Source="SYS" Set need=##class(Packing.Needs.State).StateIdOpen(json."Department",technicalProduct.%Id(),$ZDate(+$Horolog,3)_" 00:00:00",json."DeliveryBy",attributes,4) //attributes parameter should be in $List format
go to post Matjaz Murko · Feb 3, 2021 It's true, prior 1970 $ZDateTime with -2 format throws error. But that's no problem, because I'm using current date/time only. So the Robert's solution is fine for me. Tnx!
go to post Matjaz Murko · Feb 3, 2021 Hi. Tnx for your answer. I was looking for intrinsic function... Regards, Matjaž