Nova postagem

Pesquisar

Pergunta
· Abr. 25, 2024

Possible to export a class without specific members?

Is there a way to exclude specific members from a class when exporting to an XML or UDL file? Bonus question: is there a way to import from that file without overwriting those members that were excluded?

The use case is to export an interoperability production class without the ProductionDefinition XDATA. We plan to source control the production items through the Ensemble Deployment Manager, but we still need to export any custom code in the class definition itself.

3 Comments
Discussão (3)1
Entre ou crie uma conta para continuar
Pergunta
· Abr. 25, 2024

Complete novice question

I'm trying to learn M programing for an Epic db class prerequisite. They said to download the IRIS Studio software to do the testing. I'm having a very difficult time finding information the language. I'm trying to run some examples that Epic has provided (like in below) but the compiler complains that it isn't valid. Of course, it doesn't tell you why it isn't valid.

 

r !,"Enter the hour: ",hr  
 r !,"Enter the minute: ",min 
 r !,"Enter the second: ",sec 
 s Mtime=$$ConvertToMTime(hr,min,sec)
 w !,"Equivalent M time: ",Mtime  
 q
ConvertToMTime(h,m,s)
 q (h*3600)+(m*60)+(s)

I get these errors:

ERROR: zipcodevalidate.int(11) #8: <NOLINE>
 TEXT: s Mtime=$$ConvertToMTime(hr,min,sec)
ERROR: zipcodevalidate.int(14) #1026: Invalid command : 'ConvertToMTime(h,m,s)' : Offset:15
 TEXT: ConvertToMTime(h,m,s)

 

Would appreciate any guidance on why this doesn't work or some sources to better understand how to use Studio.

8 Comments
Discussão (8)4
Entre ou crie uma conta para continuar
Artigo
· Abr. 25, 2024 3min de leitura

Making A Variable Watch Itself

I came up with a challenge for myself to come up with a way to make a variable watch itself for a certain value and do something when it hits that value without having to check it every time something touches it. Basically, a way to say "if at any point during the execution of this code, if x = 0 (or whatever the condition is) do this thing." The class I ended up with watches a %Status:

Class User.WatchedStatus Extends %RegisteredObject
{
Property sc As %Status [ InitialExpression = 1, SqlComputeCode = {set {*} = ##class(User.WatchedStatus).Reset({sc},{resetSelf})}, SqlComputed, SqlComputeOnChange = isErr ];
Property isErr As %Boolean [ InitialExpression = 0, SqlComputeCode = {set {*} = ##class(User.WatchedStatus).ErrCheck({sc},{writeSelf},{logSelf},{throwSelf})}, SqlComputed, SqlComputeOnChange = sc ];
Property throwSelf As %Boolean [ InitialExpression = 0 ];
Property logSelf As %Boolean [ InitialExpression = 0 ];
Property writeSelf As %Boolean [ InitialExpression = 0 ];
Property resetSelf As %Boolean [ InitialExpression = 0 ];

/// Handles status according to flags set, then sets isErr.
ClassMethod ErrCheck(sc, writeSelf, logSelf, throwSelf) As %Boolean [ Internal ]
{
	if $$$ISERR(sc){
		if writeSelf{
			write $SYSTEM.Status.GetErrorText(sc)
		}
		if logSelf = 1{
			do ##class(%Exception.StatusException).CreateFromStatus(sc).Log()
		}
		if throwSelf = 1{
			$$$ThrowStatus(sc)
		}
		quit 1
	}
	else{
		quit 0
	}
}

/// If resetSelf is true, resets the status code after error handling occurs.
ClassMethod Reset(sc, resetSelf) As %Status [ Internal ]
{
	return:resetSelf $$$OK
	return sc
}

/// flags is a string which determines status behavior when an error occurs
/// T = throw the status
/// L = log the status as an exception
/// W = write the status error text
/// R = reset status after error handling; if set, isErr goes back to 0 and sc goes back to 1
ClassMethod New(flags As %String) As User.WatchedStatus
{
	set status = ##class(User.WatchedStatus).%New()
	set flags = $ZCVT(flags,"U")
	set:(flags [ "T") status.throwSelf = 1
	set:(flags [ "L") status.logSelf = 1
	set:(flags [ "W") status.writeSelf = 1
	set:(flags [ "R") status.resetSelf = 1
	return status
}

}

If I create a new instance of this class using set status = ##class(User.WatchedStatus).New("wr"), then when I call methods that return a %Status, I can use set status.sc = (whatever method here) and if it returns an error status, it will write that status without me having to check if it's an error and tell it to do that every time, then reset itself for its next use. I also have a t or an l flag for if I want the status to throw itself or log itself as an exception in the system logs. (Note that if I didn't include the r flag, it wouldn't reset itself so that you could still check out the status code afterward.)

This uses SqlComputeCode in a way that it probably isn't meant to be used, and you have to be careful writing it this way. Since isErr computes itself on change of sc and sc computes itself on change of isErr, you could get yourself into a loop. That won't happen here because the the whole system will eventually settle again.

I'm not sure how much mileage everyone else will get out of this %Status example, but I'm documenting how I did it here anyway in case anyone else is ever trying to figure this out for a different kind of object.

Discussão (0)1
Entre ou crie uma conta para continuar
Discussão (1)1
Entre ou crie uma conta para continuar
Pergunta
· Abr. 25, 2024

is there anyway to find the current UTC by city

We are using the IRIS cloud. and I am working on a DTL .

so the source side timestamp is  local time for example 20240110134740,  I know it is a local time. so the requirement is I need to append the UTC at the end, like -0400 or -0500 depending on if it is daylight saving time.  

so is there function to return if current day is at daylight saving time, so I can decide if I need to append the -400 or -500? or a function to return the current UTC by location? 

3 Comments
Discussão (3)2
Entre ou crie uma conta para continuar