go to post Ashok Kumar T · Apr 13, 2024 Hello @Parameshwaran Muthaiyan The current approach you have implemented is the exact approach. because, You have to execute the query every time if we are modify the conditional values. Otherwise the results will remine the same.
go to post Ashok Kumar T · Feb 6, 2024 Hello @Sylvain Guilbaud Yeah, You are right. I haven't tried for TOP clause but it's works for WHERE . Thanks for pointing this.
go to post Ashok Kumar T · Feb 6, 2024 Usually you will get a serialization JSON (string) in result. You can do deserialization by using %DynamicObject.
go to post Ashok Kumar T · Feb 4, 2024 Hi @Pierre LaFay Define a Method instead of ClassMethod and Instantiate the object for that class and call the required method. It will work Class Bna.Utils.Sql Extends %RegisteredObject { ClassMethod RemoveIrisTestUsers() As %Status { set obj = ..%New() New $NameSpace Set $NameSpace="%SYS" // Get test users by login begining Set query = "select * from Security.Users "_ "where "_ "ID like LOWER('ARS%') or"_ "ID like LOWER('CHERCHEUR%') or"_ "ID like LOWER('CS%') or"_ "ID like LOWER('DGOS%') or"_ "ID like LOWER('CENTRE%')" Set sc =obj.SelectFirstColsInArray(query, .userIds) if 'sc Return sc zw userIds Return $$$OK } Method SelectFirstColsInArray(query, test) { zwrite query,test return $$$OK } }
go to post Ashok Kumar T · Jan 26, 2024 The FHIR logs are stored in the global ^FSLOG . Enable this logging by declaring the ^FSLogChannel
go to post Ashok Kumar T · Jan 26, 2024 Useful SQL JSON functions. I would like to include one more Aggregate function SQL JSON_ARRAYAGG into this list. Create JSON object and push into JSON array based on condition or entire rows select JSON_ARRAYAGG(JSON_OBJECT('Id':Id,'Name':Name,'phoneNumber':Phone,'State':state)) As JSON from Sample.Person
go to post Ashok Kumar T · Jan 24, 2024 Thanks @Julius Kavay , Ok. Yes, both global and private global storage at the first time of initialization. Why does it consumes minimum 8 byte(seems default and Is this Default byte size) regardless of single character(1 byte) in $storage. It consumes same or more than same byte when store in to global. Is this actual physical storage size(bytes) for the global. LEARNING>Set ^TEST="a" LEARNING>d ^%GSIZE Global ^TEST directory: c:\intersystems\irishealth\mgr\learning\ Page: 1 GLOBAL SIZE 24 Jan 2024 11:26 AM Global Blocks Bytes Used Packing Contig. -------- -------- --------------- ------- ------- TEST 1 12 0 % 0 TOTAL Blocks Bytes Used Packing Contig. -------- -------- --------------- ------- ------- 1 12 0 % 0 <RETURN> to continue or '^' to STOP:
go to post Ashok Kumar T · Jan 21, 2024 For testing purpose you can set the %ALL role and try test it again
go to post Ashok Kumar T · Jan 21, 2024 Hello @Andy Stobirski Have you created a web application? If not, You have to create a web application. Configure the necessary details such as namespace, url add your PCRest.disp in dispatch class and assign roles. Save the application and call your RESTFul api from postman. /// Says Hello ClassMethod Hello() As %Stream.Object { return {"status":"ok","message":"working"} }
go to post Ashok Kumar T · Jan 21, 2024 Hello @Andy Stobirski The property "swagger" is an mandatory field and the value should be string value "2.0" not even integer 2 or anything other than "2.0". If you defined the mandatory fields then it should work.
go to post Ashok Kumar T · Dec 22, 2023 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 Ashok Kumar T · Dec 21, 2023 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 Ashok Kumar T · Dec 21, 2023 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 Ashok Kumar T · Dec 21, 2023 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 }