Those are system routines so you can not find their source code available.

But you do not need to import them into your project because the compiled version is always available in the destination environment where you plan to import the project.  

As Eduard Lebedyuk say is better to use the new $SYSTEM functions.

You can check for the size of the %request content reading "%request.Content.Size" and read the exact amount of bytes but keep in mind that , as Vitaliy already said, as long as you read a stream into a string you have to deal with the string Max Length. 

Hi Mark,

 in my experience mixed indexes (both with pure numbers and strings) are not a good choice if you need to perform something like a "STARTSWITH" function. 

In order to be able to always find your matching records near one to another and speed up the search, I think you have to normalize all the values by adding the space suffix to every code, assuming that values with and without space at the end refer to the same entity.
This way you can easily search for all the occurrence of a code that is starting with a specified prefix, without reading extra lines from the global.

Also you have to add a space at the prefix variable when searching if it is not present at the end of the passed value.

But if i look at your first screen, looks like you have no pure numbers in the second subscript of the global at the moment so I do not get the point.. 

Following you can find some of my tests:

d INIT^TESTRTN
^WK3SORT(1,0,9999)=""
^WK3SORT(1,801,307077)=""
^WK3SORT(1,802,306650)=""
^WK3SORT(1,800999,311404)=""
^WK3SORT(1," ",43017)=""
^WK3SORT(1," ",161692)=""
^WK3SORT(1," ",161693)=""
^WK3SORT(1," ",209576)=""
^WK3SORT(1,"80094NMGM ",528126)=""
^WK3SORT(1,"800999 ",305403)=""
^WK3SORT(1,"800999 ",305404)=""
^WK3SORT(1,"800999 ",311403)=""
^WK3SORT(1,"800999/T51316 ",364551)=""
^WK3SORT(1,"800999CAMDEN ",356252)=""
^WK3SORT(1,"801 ",307076)=""
^WK3SORT(1,"801 ",555780)=""
^WK3SORT(1,"80110 ",479476)=""
^WK3SORT(1,"802 ",306649)=""

d NORMALIZE^TESTRTN(1)
4 Lines Converted
^WK3SORT(1," ",43017)=""
^WK3SORT(1," ",161692)=""
^WK3SORT(1," ",161693)=""
^WK3SORT(1," ",209576)=""
^WK3SORT(1,"0 ",9999)=""
^WK3SORT(1,"80094NMGM ",528126)=""
^WK3SORT(1,"800999 ",305403)=""
^WK3SORT(1,"800999 ",305404)=""
^WK3SORT(1,"800999 ",311403)=""
^WK3SORT(1,"800999 ",311404)=""
^WK3SORT(1,"800999/T51316 ",364551)=""
^WK3SORT(1,"800999CAMDEN ",356252)=""
^WK3SORT(1,"801 ",307076)=""
^WK3SORT(1,"801 ",307077)=""
^WK3SORT(1,"801 ",555780)=""
^WK3SORT(1,"80110 ",479476)=""
^WK3SORT(1,"802 ",306649)=""
^WK3SORT(1,"802 ",306650)=""

d FIND^TESTRTN(1,"8009 ")
Order: 1-80094NMGM
  Detail: 528126
Order: 1-800999
  Detail: 305403
  Detail: 305404
  Detail: 311403
  Detail: 311404
Order: 1-800999/T51316
  Detail: 364551
Order: 1-800999CAMDEN
  Detail: 356252
 
5 lines read
TESTRTN
INIT
	//Create some dataKill^WK3SORT//StringsSet^WK3SORT(1," ",43017)=""Set^WK3SORT(1," ",161692)=""Set^WK3SORT(1," ",161693)=""Set^WK3SORT(1," ",209576)=""Set^WK3SORT(1,"80094NMGM ",528126)=""Set^WK3SORT(1,"800999 ",305403)=""Set^WK3SORT(1,"800999 ",305404)=""Set^WK3SORT(1,"800999 ",311403)=""Set^WK3SORT(1,"800999/T51316 ",364551)=""Set^WK3SORT(1,"800999CAMDEN ",356252)=""Set^WK3SORT(1,"801 ",307076)=""Set^WK3SORT(1,"801 ",555780)=""Set^WK3SORT(1,"80110 ",479476)=""Set^WK3SORT(1,"802 ",306649)=""//NumbersSet^WK3SORT(1,0,9999)=""Set^WK3SORT(1,801,307077)=""Set^WK3SORT(1,802,306650)=""Set^WK3SORT(1,800999,311404)=""//Show contentzw^WK3SORTQuit
NORMALIZE(Sub)
	New (Sub)
	Set (cnt,End)=0Set Next=""Set Next=$Order(^WK3SORT(Sub,Next))
	While (Next'="")&(End=0) {
		//Check if code is pure numberIf (Next=+Next) {
			Merge^WK3SORT(Sub,Next_" ")=^WK3SORT(Sub,Next)
			Kill^WK3SORT(Sub,Next)
			Set cnt=$I(cnt)
		} Else {
			Set End=1
		}
		Set Next=$Order(^WK3SORT(Sub,Next))
	}
	Use0Write cnt_" Lines Converted",!
	//Show contentzw^WK3SORTQuit
FIND(Sub,Prefix)
	New (Sub,Prefix)
	//Setting the space char to normalize the searchIf$Extract(Prefix,$Length(Prefix))'=" "Set Prefix=Prefix_" "//Dealing with exact matchIf$Data(^WK3SORT(Sub,Prefix)) {
		Use0Write"Order: "_Sub_"-"_Prefix_" ",! 
		Do GETDETAILS(Sub,Prefix)
	}
	//Looping trough the recordsSet End=0,Cnt=0Set Next=$Order(^WK3SORT(Sub,Prefix))
	While (Next'="")&(End=0) {
		Set cnt=$Increment(cnt)
		//Test if current value starts with the Prefix string passed or if it is a single space charIf ($Extract(Next,1,$Length(Prefix)-1)=$Extract(Prefix,1,$Length(Prefix-1)))!((Prefix=" ")&(Prefix=Next)) {
			Use0Write"Order: "_Sub_"-"_Next_" ",!
			Do GETDETAILS(Sub,Next)
		} Else {
			Set End=1
		}
		Set Next=$Order(^WK3SORT(Sub,Next))
	}
	Use0Write !,cnt_" lines read",!
	Quit//Extract detils subscripts
GETDETAILS(Sub,Ord)
	New (Sub,Ord)
	Set Det=""Set Det=$Order(^WK3SORT(Sub,Ord,Det))
	While Det'="" {
		Use0Write"  Detail: "_Det,!
		Set Det=$Order(^WK3SORT(Sub,Ord,Det))
	}
	Quit

Hi, in order to do that you need to create a resource first (see: https://docs.intersystems.com/irisforhealthlatest/csp/docbook/DocBook.U…), assign that resource to your application (see: https://docs.intersystems.com/irisforhealthlatest/csp/docbook/DocBook.U…) and or zen page (see: https://docs.intersystems.com/ens201817/csp/docbook/Doc.View.cls?KEY=GZ… ) then assign this resource to your role (see: https://docs.intersystems.com/irisforhealthlatest/csp/docbook/DocBook.U…) and then assign this role to your users.

Hope this can help

The User table is SQL Mapped so I guess you can simply use the sql INSERT statement to insert users data into that table or, if you prefer, just create a new instance of the User object using .%New() and populate all the needed property of the User object.

Just pay attention to Group, Profile and password.

I suggest give the destination package a different name, maybe the original class name? or a value passed in from a parameter.

Yes or something like :

  • my.test.cls (original class)
  • my.test.check1.cls  (Method 1)
  • my.test.check2.cls  (Method 2)

To do so I've added:

Set destPackage=""if ($length(cls,".")>1),$length($translate($piece(cls,".",2,99),".")'="") set destPackage=$Piece(cls,".",2,999)
//[some code]set$piece(tmp,".",*)=destPackage_"."_met.Name		// create a new classname

It works also for me... maybe it depends on how Michael Wood is passing the json object to the method... 

If he is passing a string, there is a conversion needed from string to %DynamicAbstractObject like:

Set str="{""prio"":""2"",""code"":""A001""}"Write str
{"prio":"2","code":"A001"}
Set obj=##Class(%DynamicAbstractObject).%FromJSON(str)
Write obj
1@%Library.DynamicObjectZW obj
obj={"prio":"2","code":"A001"}  ; <DYNAMIC OBJECT>

You need to change your cursors names, use two different names in your declare statements, try it.

Some considerations about embedded SQL cursors:

1) I think using embedded SQL Cursors is a practice to be avoided in favor of %SQL.Statement class usage: 

https://docs.intersystems.com/iris20232/csp/docbook/Doc.View.cls?KEY=GS…

2) Genarally is not  a good idea to have the same name in embedded SQL cursors, even if they are in different Methods, this because of the behaviour of the Stack separations used by the embedded SQL cursors.

3) Use a close statement before every open statement of embedded SQL cursors, this prevent problems if your process crash and in the same context you re execute it.

The method GetSphereJauh work if called from terminal? 

It's looks like there are some undefined variebles there , in main method from your comment of the Aug 4 the variable "ATTRDesc" seems to be undefined and in the called method I do not see any value for "repid" variable (but it depend if your class is procedureblock or not).