What are Subroutines?

Home Forums Getting Started What are Subroutines?


Viewing 1 post (of 1 total)
  • Author
  • #400
    Wyz Create Team

    A subroutine is a reusable collection of scripts that can be called from other scripts and by multiple triggers.

    A subroutine is made up of scriplets, which is just a script that runs within another script. And, just like a script, it runs only when a Trigger occurs. But unlike a script, a subroutine can be called from other scripts. This is a major advantage. For example. You might want to repeat a series of actions (scriplets) more than once. Instead of defining a series of actions over and over again, you can define it once in a subroutine.

    Add Subroutines: Subroutines can be added at the object, page, or app level. To add subroutines, click on the green plus sign next to the Scripts heading and choose Subroutine.

    Run Subroutines: Subroutines need a Trigger to be executed, just like other scripts. To run a subroutine, within a Trigger, choose the Script ‘Run Subroutine’ from the script group ‘Program Flow Control’

    Subroutine Hierarchy: Subroutines have a hierarchy. This means that subroutines at the object level can only be called from that Object. Subroutines at the Page level can be called by any Object on the Page. Subroutines at the App level can be called by any Object on any Page of the App. When a Trigger initiates a Run Subroutine script, the program looks first at the lowest level of the hierarchy (i.e., the Object if the Trigger is within an Object); if no Subroutine exists, then the program looks at the Page, and then the App level.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.