Calling an embedded function in DTL

98 views
Skip to first unread message

Marc Lang

unread,
May 17, 2012, 6:25:34 PM5/17/12
to InterSystems: Ensemble in Healthcare
I know that in a Business Process you can put a method outside of the BPL XData like so



Class whatever Extends Ens.BusinessProcessBPL etc
{

XData BPL [etc]
{

<process language="..".>

<assign name="test" property="context.test" value="..%Process.Hello()">
</assign>

</process>
}

Method Hello() as $String
{
 quit "hello"
}

}


This lets you embed functions inside a business process.

Is there an equivalent for DTL?

I have tried putting a method outside of the XData, and calling it using ..%Process.Hello, but not having any luck.
Also tried ..%Transform.Hello.

Getting <NO CURRENT OBJECT> when I try to "Test Transformation"

Is this possible?

David Loveluck

unread,
May 17, 2012, 6:43:28 PM5/17/12
to ensemble-in...@googlegroups.com

Marc

 

A transform, like BPL  is just  a class. In studio, you could ‘view other’ and add methods in exactly the same way that you add methods to a business process.

 

The real issue here, is how you might invoke the method and I don’t think it is likely to be much help.

 

From a business process, message router or the testing page (or from your own code if you chose) the DTL is executed by calling the class method Transform(). The transform is never instantiated as an object, so you can’t call instance methods of the transform. That is why you have <NO CURRENT OBEJCT> from the test page.

 

You could add a class method to the transform and call it with the usual class method syntax, but this doesn’t normally give any advantage over calling a method from a utility class, such as one used to build custom functions.

 

Is there a particular reason you want to add a method?

 

dave

--
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare Community" group.
To post to this group, send email to Ensemble-in...@googlegroups.com
To unsubscribe from this group, send email to Ensemble-in-Healt...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Ensemble-in-Healthcare?hl=en

Marc Lang

unread,
May 18, 2012, 3:11:26 AM5/18/12
to ensemble-in...@googlegroups.com
Hi David,

Yeah, last night I realised it would require a class method.

No real reason I would use this over a utility class, just like having options.

Thanks
Reply all
Reply to author
Forward
0 new messages