Nova postagem

Rechercher

Artigo
· Mar. 7 3min de leitura

Forcer une variable à s'auto-observer

Je me suis lancé un défi : trouver un moyen de faire en sorte qu'une variable se surveille elle-même pour une certaine valeur et fasse quelque chose lorsqu'elle atteint cette valeur sans avoir à la vérifier à chaque fois que quelque chose la touche. En gros, un moyen de dire "à un moment donné pendant l'exécution de ce code, si x = 0 (ou quelle que soit la condition) faire ceci". La classe avec laquelle j'ai fini par surveiller un %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
}

}

Si je crée une nouvelle instance de cette classe en utilisant set status = ##class(User.WatchedStatus).New("wr"), alors lorsque j'appelle des méthodes qui renvoient un %Status, je peux utiliser set status.sc = (quelle que soit la méthode ici) et si elle renvoie un statut d'erreur, elle écrira ce statut sans que j'aie à vérifier s'il s'agit d'une erreur et lui dire de le faire à chaque fois, puis se réinitialisera pour sa prochaine utilisation. J'ai également un indicateur t ou l pour savoir si je veux que le statut se déclenche ou s'enregistre comme une exception dans les journaux système. (Notez que si je n'incluais pas l'indicateur r, il ne se réinitialiserait pas, de sorte que vous pourriez toujours vérifier le code de statut par la suite.)

Cela utilise SqlComputeCode d'une manière qui n'est probablement pas censée être utilisée, et vous devez être prudent en l'écrivant de cette façon. Étant donné que isErr se calcule lui-même lors d'un changement de sc et que sc se calcule lui-même lors d'un changement d'isErr, vous pourriez vous retrouver dans une boucle. Cela n'arrivera pas ici, car l'ensemble du système finira par se stabiliser à nouveau.

Je ne sais pas exactement à quel point tout le monde tirera parti de cet exemple de %Status, mais je documente ici comment je l'ai fait au cas où quelqu'un d'autre essaierait de comprendre cela pour un autre type d'objet.

Discussão (0)1
Entre ou crie uma conta para continuar
Pergunta
· Mar. 6

SDA3 to HL7 transform

Has anyone used this transform to convert SDA3 to HL7?

HS.Gateway.SDA3.SDA3ToHL7.ADTA0N

Seeing below error

ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/PatientNumbers/[1]/Organization/UniversalId' because UniversalId in /Patient/PatientNumbers/[1]/Organization/UniversalId is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/PatientNumbers/[2]/Organization/UniversalId' because UniversalId in /Patient/PatientNumbers/[2]/Organization/UniversalId is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/Name/MiddleName' because MiddleName in /Patient/Name/MiddleName is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/Name/NameSuffix' because NameSuffix in /Patient/Name/NameSuffix is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/Name/NamePrefix' because NamePrefix in /Patient/Name/NamePrefix is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/MothersFullName/GivenName' because GivenName in /Patient/MothersFullName/GivenName is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/MothersFullName/MiddleName' because MiddleName in /Patient/MothersFullName/MiddleName is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/MothersFullName/NameSuffix' because NameSuffix in /Patient/MothersFullName/NameSuffix is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/MothersFullName/NamePrefix' because NamePrefix in /Patient/MothersFullName/NamePrefix is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/MothersFullName/NamePrefix' because NamePrefix in /Patient/MothersFullName/NamePrefix is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/Aliases/[1]/MiddleName' because MiddleName in /Patient/Aliases/[1]/MiddleName is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/Aliases/[1]/NameSuffix' because NameSuffix in /Patient/Aliases/[1]/NameSuffix is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/Race/CodeSystemVersionId' because CodeSystemVersionId in /Patient/Race/CodeSystemVersionId is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/Races/[1]/CodeSystemVersionId' because CodeSystemVersionId in /Patient/Races/[1]/CodeSystemVersionId is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/PrimaryLanguage/Code' because Code in /Patient/PrimaryLanguage/Code is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/PrimaryLanguage/SDACodingStandard' because SDACodingStandard in /Patient/PrimaryLanguage/SDACodingStandard is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/MaritalStatus/SDACodingStandard' because SDACodingStandard in /Patient/MaritalStatus/SDACodingStandard is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/Religion/SDACodingStandard' because SDACodingStandard in /Patient/Religion/SDACodingStandard is not an element, instead this node is a 'unknown' node. + ERROR <Ens>ErrGeneral: Can't evaluate DOM path '/Patient/EnteredOn/' because EnteredOn in /Patient/EnteredOn is not an element, instead this node is a 'unknown' node.

Discussão (0)1
Entre ou crie uma conta para continuar
Pergunta
· Mar. 6

Running app outside container Linux

Hi,

I would like to convert an html zen page to PDF using wkhtmltopdf so I've installed it in Ubuntu and the command wkhtmltopdf but because I've my IRIS installed in a container that command is not recognized and we can't install wkhtmltopdf  in the container so is there a way to be able to run this command?  

Thanks

3 Comments
Discussão (3)1
Entre ou crie uma conta para continuar
Anúncio
· Mar. 6

[Video] Creating and Managing VPNs with InterSystems Network Connect

Hi, Community!

🔒Are you linking your InterSystems Cloud Services deployments to a private network? See how to do this securely:

Creating and Managing VPNs with InterSystems Network Connect

In this video, @Gunnar Hammonds shows how to set up your VPN connections and manage routing. He also introduces networking concepts like BGP peering.

New to InterSystems Cloud Services? Get an overview (video, 4m).

Discussão (0)1
Entre ou crie uma conta para continuar
Anúncio
· Mar. 6

Kick-off Webinar for InterSystems AI Programming Contest

Hey Community,

We're pleased to invite all the developers to the upcoming kick-off webinar for the InterSystems AI Programming Contest!

Discover the exciting challenges and opportunities that await Vector Search, GenAI and AI Agents enthusiasts in this contest. We'll discuss the topics we expect from participants and show you how to develop, build, and deploy applications using the InterSystems IRIS data platform.

Date & Time: Monday, March 17 – 11 am EST | 5 pm CET  

Speakers:  
🗣 @Thomas Dyar, Product Manager
🗣 ​​​@Dean Andrews, Head of Developer Relations
🗣 ​​​@Derek Gervais, Developer Relations Evangelist

✅ Register for the kick-off today!

1 Comment
Discussão (1)1
Entre ou crie uma conta para continuar