<scope xpos='200' ypos='250' xend='200' yend='800' > <code name='Transform' xpos='200' ypos='350' > <![CDATA[ /* If I use a <transform> activity with indirection (@$parameter(request,"%DTL")), and assign the returned object to the context, and an error is produced when the context is saved because the returned object has, say, missing properties, IRIS will only see this error too late and the scope we defined will not be able to help us to deal with this fault. So, in order to avoid this bug, we need to call the transformation from a <code> activity instead. And try to save the returned object before assigning it to the context and returning. If we can't save it, we must assign the error to the status variable and leave the context alone. This way the <scope> will capture the problem and take us to the <catchall> activity. */ Set tTransformClass=$parameter(request,"%DTL") Set status = $classmethod(tTransformClass, "Transform", request, .normalizedRequest) If $$$ISERR(status) Quit Set status = normalizedRequest.%Save() If $$$ISERR(status) Quit Set context.NormalizedData=normalizedRequest ]]> </code> <assign name="Done" property="context.Action" value=""Done"" action="set" xpos='200' ypos='550' /> <faulthandlers> <catchall name='Normalization error' xpos='200' ypos='650' xend='200' yend='1150' > <trace name='Normalization problem' value='"Normalization problem"' xpos='200' ypos='250' /> </catchall> </faulthandlers>
- Log in to post comments