Daniel McGowan · Jun 25, 2020 go to post

Ahhhhhh, i didn't know that! Well in that case it works! looks alot tidier now then:

ClassMethod ExecuteClassMethods(Functions As %DynamicArray) As %Status
{
	s arrFns = Functions.%GetIterator()

	while arrFns.%GetNext(.Key, .Obj) {

		s arrArgs = Obj.Arguments.%GetIterator()

		while arrArgs.%GetNext(.aKey, .Item) {
			s Args = aKey + 1
			s Args(Args) = Item
		}
		
		d $ClassMethod(Obj.Class, Obj.Method, Args...)
	}

	q $$$OK
}
Daniel McGowan · Jun 25, 2020 go to post

Well when i try that in the above code as:

ClassMethod WriteSegment(Functions As %DynamicArray) As %Status
{
	s arrFns = Functions.%GetIterator()

	while arrFns.%GetNext(.Key, .Obj) {
		s arrArgs = Obj.Arguments.%GetIterator()

		while arrArgs.%GetNext(.aKey, .Item) {
			s Args(aKey + 1)=Item
		}
		d $ClassMethod(Obj.Class, Obj.Method, Args...)

	q $$$OK
}

i get an error in the called function: <UNDEFINED>zWriteSomething+1^Report.Elements.1 *Arg1 the Args array looks like this: Args(1)="Hi"

Daniel McGowan · Jun 25, 2020 go to post

I think thats because you are passing the arguments into the CallHook function formally, which i am not here. I tried constructing an array in the arrArgs loop and passing that byRef but it didnt work...

D

Daniel McGowan · Jun 24, 2020 go to post

Its a shame theres no easier way i guess but ill stick with for now then unless anyone else has any alternatives.

I was going to make the Class property fall back to $this but then i decided to move this function to a utility class and call it within my WriteSegment method to make it more generic.

Unless theres a way to get the calling class within a method...?

Daniel McGowan · Jun 24, 2020 go to post

How about this then... couldn't find a better way to pass multiple args though...


ClassMethod WriteSegment(Functions As %DynamicArray) As %Status
{
	w "Start",!

	s arrFns = Functions.%GetIterator()

	while arrFns.%GetNext(.Key, .Obj) {
		s Args=""
		s arrArgs = Obj.Arguments.%GetIterator()

		while arrArgs.%GetNext(.aKey, .Item) {
			s $LI(Args, *+1)=Item
		}

		d $Case($LL(Args),
			0: $ClassMethod(Obj.Class, Obj.Method),	
			1: $ClassMethod(Obj.Class, Obj.Method, $LG(Args, 1)),	
			2: $ClassMethod(Obj.Class, Obj.Method, $LG(Args, 1), $LG(Args, 2)),	
			3: $ClassMethod(Obj.Class, Obj.Method, $LG(Args, 1), $LG(Args, 2), $LG(Args, 3)),	
			4: $ClassMethod(Obj.Class, Obj.Method, $LG(Args, 1), $LG(Args, 2), $LG(Args, 3), $LG(Args, 4)),	
			5: $ClassMethod(Obj.Class, Obj.Method, $LG(Args, 1), $LG(Args, 2), $LG(Args, 3), $LG(Args, 4), $LG(Args, 5)),	
			6: $ClassMethod(Obj.Class, Obj.Method, $LG(Args, 1), $LG(Args, 2), $LG(Args, 3), $LG(Args, 4), $LG(Args, 5), $LG(Args, 6)),	
			7: $ClassMethod(Obj.Class, Obj.Method, $LG(Args, 1), $LG(Args, 2), $LG(Args, 3), $LG(Args, 4), $LG(Args, 5), $LG(Args, 6), $LG(Args, 7)),	
			8: $ClassMethod(Obj.Class, Obj.Method, $LG(Args, 1), $LG(Args, 2), $LG(Args, 3), $LG(Args, 4), $LG(Args, 5), $LG(Args, 6), $LG(Args, 7), $LG(Args, 8))
		)
	}

	w "End",!

	q $$$OK
}

ClassMethod WriteSomething(Arg1 As %String) As %Status
{
	w !,Arg1,!
	q $$$OK
}

ClassMethod WriteSomethingElse(Arg1 As %String, Arg2 As %String) As %Status
{
	w !,Arg1,", ",Arg2,!
	q $$$OK
}

ClassMethod Testing() As %Status
{
	d ..WriteSegment([
		{
			"Class": ($ClassName()),
			"Method": "WriteSomething",
			"Arguments": [ "Hi" ]
		}, {
			"Class": ($ClassName()),
			"Method": "WriteSomethingElse",
			"Arguments": [ "Bye", "Waves" ]
		}
	])
	q $$$OK
}
Daniel McGowan · Jun 24, 2020 go to post

Thanks for the response, just updated my OP, maybe its clearer now what i am trying to acheive...

Daniel McGowan · Mar 16, 2020 go to post

Hello again, so i got docker set up and cache installed but i don't actually have a licence for red hat, and vs code seems to tip it over the allowed one. 

Daniel McGowan · Mar 14, 2020 go to post

Thanks for the tips, much appreciated! I’ll get back to you on my success (hopefully) with this 
 

im using vscode and your plugin already, it’s very good, I’ve been following it for a long time, I don’t care much for eclipse and atelier, so glad you’ve added the intellisense in now too!

I’m not sure we can upgrade to iris with out current licences so for now I’m just trying to create a local dev environment on Mac, mostly because of the whole work from home movement. I had no issues setting it up in Mojave but it seems to have gotten a lot more difficult since!

id love to contribute to the project too if I can, let me know if there’s anything you need.

thanks,

Dan

Daniel McGowan · Mar 14, 2020 go to post

Hi thanks for the reply, yes it’s for development purposes. The production servers are actually on windows servers. 
 

The latest cache version for Mac, 2018 I think? I can confirm tomorrow and add the cconsole.log nothing else was particularly remarkable in the logs though. 
 

any good guides on docker images for cache? I’m not too familiar with that...

thanks for the help so far.