Published on InterSystems Developer Community (https://community.intersystems.com)

Home > Function to list all written function in a Cache Routine

Question
Limyandi Vicotrico · Aug 23, 2020

Function to list all written function in a Cache Routine

Hi Everyone,

Has anyone tried to write down a function in a routine that list all of possible function inside the routine?
I can only think of iterating through the routine line one by one and differentiate between function and function definition.
Is there any existing function that can be utilised? I think it should work similar to how

do function^routineName 

works. I could not find the source for how "do" works, but I believe do will look at the list of function in the routine, and if it finds it, it will call the function, but if it does not find it, it will give an error?

Can someone please shed a light on this? Thank you.

EDIT:
My goal is to create a menu for a utility routine. This menu function should be able to detect all the function written in the routine automatically, so everytime a new function is added, calling the menu will show the new function I have written.

Manually, this is what I would do:
image
But this will require me to update the function every time.

#Terminal #Caché #InterSystems IRIS

Source URL:https://community.intersystems.com/post/function-list-all-written-function-cache-routine