Yes Of course, We can store the object id's directly to the list of object property by using ( ex: $lb($lb("1"),$lb("2")) ) it. However we stored the values through objects. Basically the basic behaviour of storing the primary object automatically stores it's reference objects by default(DeepSave).So, I don't need to save multiple objects manually. Eventually it revokes both primary and reference object in failure state. No transactions involved in the code logic. If I save the secondary objects before storing the primary creates discrepancy in my data, Incase of failure. I thought to implement the same flow via SQL if possible.
No, I've a object property as a list like Property CodeTable As list of Sample.CodeTable in my class definition. and inserting values through object refer the code below. Now I expect to insert list of object via SQL instead of object.
Class Samples.NewClass Extends%Persistent
{
Property Name As%String;Property codetable As list Of Sample.CodeTable;Property mycList As list Of %String;Property Notes As%Stream.GlobalCharacter;ClassMethod c1()
{
set obj = ..%New()
set codetable = ##class(Sample.CodeTable).%New()
set codetable.Code="V"do obj.codetable.Insert(codetable) ;insert my Code table object as a list of set codetable = ##class(Sample.CodeTable).%New()
set codetable.Code="X"do obj.codetable.Insert(codetable)
set tSC = obj.%Save()
}
}
The form-data is actually resides in MimeData property and the query parameters are in Data property in %request object. You can you use GetMimeData method to retrieve a single from-data or use NextMimeData for series fetch and The form-data value is in the form of stream. Get method is used to get query parameters from the %request.
ClassMethod SampleCode() As%Status
{
write"query parameter: ",%request.Get("testParam")
set mime=""while1{
set mime = %request.NextMimeData(mime) q:mime=""write mime,!
}
return$$$OK
}
If those values are not part of the response. Then don't need to worry about it. Code will skip by default. Incase if the property is not defined . Then you have to declare the %JSONIGNOREINVALIDFIELD value as 1 to prevent from that ERROR #9406: Unexpected format for value of field.
That's right, However Instead of creating a custom datatype to fix this. create/use the auto generated method for that property "OPDTLogicalToXSD" and implement the code logic.
As You can create a class method with name of your property " OPDTLogicalToXSD" and add the code conversion for the datetime as mentioned by @Enrico Parisi at XML export time.
The default implementation of the XMLExportToString in %XML.Adaptor basically converts the date format as 2023-11-28T13:57:26Z for the property value by the logic $translate(value," ","T")_"Z"). So, I guess you may need to convert by own.
go to post
Congratulations to the winners!
go to post
Sure will try it.
go to post
Yes Of course, We can store the object id's directly to the list of object property by using ( ex:
$lb($lb("1"),$lb("2"))
) it. However we stored the values through objects. Basically the basic behaviour of storing the primary object automatically stores it's reference objects by default(DeepSave).So, I don't need to save multiple objects manually. Eventually it revokes both primary and reference object in failure state. No transactions involved in the code logic. If I save the secondary objects before storing the primary creates discrepancy in my data, Incase of failure. I thought to implement the same flow via SQL if possible.go to post
Hello @Eduard Lebedyuk
Table have data. Incase If I make it as array then it will be no longer a list and its totally different for my case.
go to post
Hello @David Hockenbroch
No, I've a object property as a list like
Property CodeTable As list of Sample.CodeTable
in my class definition. and inserting values through object refer the code below. Now I expect to insert list of object via SQL instead of object.Class Samples.NewClass Extends %Persistent { Property Name As %String; Property codetable As list Of Sample.CodeTable; Property mycList As list Of %String; Property Notes As %Stream.GlobalCharacter; ClassMethod c1() { set obj = ..%New() set codetable = ##class(Sample.CodeTable).%New() set codetable.Code="V" do obj.codetable.Insert(codetable) ;insert my Code table object as a list of set codetable = ##class(Sample.CodeTable).%New() set codetable.Code="X" do obj.codetable.Insert(codetable) set tSC = obj.%Save() } }
go to post
The form-data is actually resides in MimeData property and the query parameters are in Data property in %request object. You can you use GetMimeData method to retrieve a single from-data or use NextMimeData for series fetch and The form-data value is in the form of stream. Get method is used to get query parameters from the %request.
ClassMethod SampleCode() As %Status { write "query parameter: ",%request.Get("testParam") set mime="" while 1{ set mime = %request.NextMimeData(mime) q:mime="" write mime,! } return $$$OK }
go to post
You can make the call activity to sync by unchecking the Asynchronous check box in the call activity.
go to post
Hello @Nimisha Joseph
Can you try the below
XData BPL [ XMLNamespace = "http://www.intersystems.com/bpl" ] { <process language='objectscript' request='Ens.Request' response='Ens.Response' height='2000' width='2000' > <context> <property name='Forename' type='%String' instantiate='0' > <parameters> <parameter name='MAXLEN' value='50' /> </parameters> </property> <property name='Surname' type='%String' instantiate='0' > <parameters> <parameter name='MAXLEN' value='50' /> </parameters> </property> <property name='ReportDiscipline' type='%String' instantiate='0' > <parameters> <parameter name='MAXLEN' value='50' /> </parameters> </property> <property name='tResult' type='%SQL.StatementResult' instantiate='0' /> </context> <sequence xend='200' yend='950' > <trace name='TEMP trace element' value='"In business process "_request.StringValue' xpos='200' ypos='250' /> <assign property="context.ReportDiscipline" value="request.StringValue" action="set" xpos='200' ypos='350' /> <trace value='"ReportDiscipline value: "_context.ReportDiscipline' xpos='200' ypos='450' /> <assign property="context.tResult" value="##Class(%SQL.Statement).%ExecDirect(,"select * from table")" action="set" xpos='200' ypos='550' /> <while condition='context.tResult.%Next()' xpos='200' ypos='650' xend='200' yend='450' > <assign property="context.surname" value="context.tResult.%Get("surname")" action="set" xpos='200' ypos='250' /> </while> <trace value='"SQLCODE: "_SQLCODE' xpos='200' ypos='750' /> <trace value='"returned value: "_context.Forename' xpos='200' ypos='850' /> </sequence> </process> }
go to post
Never mind.Its actually I've missed
go to post
Thanks @Vitaliy Serdtsev
I'll try this!
go to post
For FHIR message you should use the Content-Type application/fhir+json (refer section 3.2.0.1.10 Content Types and encodings)
go to post
Kudos to the winners!
go to post
Hi @Sapan Parikh
Can you add bit more details about it.
go to post
Hello @Denys Kondratiuk
you can use below code to convert the response data to JSON object
ClassMethod test() { set response = ##Class(%DynamicAbstractObject).%FromJSON(%request.HttpResponse.Data) set iter = response.%GetIterator() while iter.%GetNext(.key,.obj) { ;looping the array object Write "Name: ", obj.Name, ! Write "Gender: ", obj.Gender, ! } }
go to post
Congratulations to all the winners!
go to post
Hello @Michael Wood
If those values are not part of the response. Then don't need to worry about it. Code will skip by default. Incase if the property is not defined . Then you have to declare the %JSONIGNOREINVALIDFIELD value as 1 to prevent from that ERROR #9406: Unexpected format for value of field.
Parameter %JSONIGNOREINVALIDFIELD As BOOLEAN = 1;
go to post
Hello @Enrico Parisi
That's right, However Instead of creating a custom datatype to fix this. create/use the auto generated method for that property "OPDTLogicalToXSD" and implement the code logic.
ClassMethod OPDTLogicalToXSD(%val As %TimeStamp) As %String [ ServerOnly = 1 ] { Set %val=##class(%Library.TimeStamp).LogicalToXSD(%val) Quit $translate(%val,"TZ"," ") }
go to post
Hello @water huang
As You can create a class method with name of your property " OPDTLogicalToXSD" and add the code conversion for the datetime as mentioned by @Enrico Parisi at XML export time.
It's suitable for both XML and JSON adaptor.
Sample code.
Class Samples.NewClass2 Extends (%Persistent, %Populate, %JSON.Adaptor, %XML.Adaptor) { Property OPDT As %Library.DateTime; ClassMethod OPDTLogicalToXSD(%val As %TimeStamp) As %String [ ServerOnly = 1 ] { Set %val=##class(%Library.TimeStamp).LogicalToXSD(%val) Quit $translate(%val,"TZ"," ") } }
output
go to post
Hello @water huang,
The default implementation of the XMLExportToString in %XML.Adaptor basically converts the date format as 2023-11-28T13:57:26Z for the property value by the logic $translate(value," ","T")_"Z"). So, I guess you may need to convert by own.
go to post
Hello @Andy Khemraj
Are you returning the file name with business operation response.