Utility Functions and $Functions

48 views
Skip to first unread message

Gary

unread,
Jun 3, 2010, 12:04:41 PM6/3/10
to InterSystems: Ensemble in Healthcare
Hi All,

I am currently struggling to get my head around the concept of using a
Utility Function in DTL and the $ type functions in BPL.

Am I correct in understaning that you cannot use Utility Functions in
BPL code and what is the concept behind functions such as $Extract.

I came accross this misunderstanding as I had previously used the In
utility function from within DTL code but I could not figure out how
to implement the same in BPL, instead having to use $Find.

So I am confused, are Utility Functions and these $ functions two
separate sets of functions and is there an equivalent for each one etc
and why can't I use a utility function in BPL.

I have read the documentation but cant seem to grasp the reason behind
the differences etc.

Cheers,
Gary

Dale du Preez

unread,
Jun 3, 2010, 12:20:24 PM6/3/10
to ensemble-in...@googlegroups.com
Hi Gary,

The DTL editor was designed to make the functions easy to use, and to
abstract them away from raw COS functions like $find. The context is
slightly different in BPL, but the functions are still available, albeit
in a more complicated fashion. The class which implements the basic
functions in Ens.Util.FunctionSet, so the functions you are used to can
be invoked using the normal classmethod syntax:
Set isIn = ##class(Ens.Util.FunctionSet).In(value, items)

To be completely honest, these functions can be used in any code if one
uses this full syntax. I'll look into whether we can make these methods
simpler to access in future.

I hope this helps,
Dale

> --
> 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
>

David Loveluck

unread,
Jun 3, 2010, 1:09:52 PM6/3/10
to ensemble-in...@googlegroups.com
with regard to " ... are Utility Functions and these $ functions two separate sets of functions and is there an equivalent for each one etc".

the background is that the $ functions are the built in functions of Object Script as a language and many go back decades.

The utility functions first started in business rules. Business Rules are dynamic and it was essential to restrict what an author could call. Since these were authored by 'non programmers' we also made it easy to call them.

DTL was also often written by the same people who wrote Routing Rules, so we gave DTL the same easy to use interface to the utility functions.

The object script built in functions have evolved over decades and many provide exactly what people want to do to manipulate strings, so many utility functions are just wrappers for these, but there are utility functions that are not based on $ functions and many $ functions that would be totally inappropriate.

dave


David Loveluck
617 225 3122

Gary

unread,
Jun 4, 2010, 4:32:59 AM6/4/10
to InterSystems: Ensemble in Healthcare
Hi,

Thanks for your replies, this is exactly what I was looking for.

Thanks again,
Gary

On 3 June, 18:09, David Loveluck <David.Lovel...@intersystems.com>
wrote:
> > For more options, visit this group athttp://groups.google.com/group/Ensemble-in-Healthcare?hl=en
>
> --
> 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 athttp://groups.google.com/group/Ensemble-in-Healthcare?hl=en- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages