Global script in Visual Processes

Altair Forum User
Altair Forum User
Altair Employee
edited January 2018 in Community Q&A

I am trying to call a function defined in "Global Declarations" under "Standard Processes" > "Scripts" from a script element of my Visual Process.

I get an error saying that the function is not declared or it may be inaccessible due to its protection level.

 

It works fine when called from a Standard Process (either from pre process or post process script). Is the Global Declarations only for use within Standard Process? Is there an equivalent for Visual Process?

I don't want to duplicate script code in my visual processes. Is there a workaround?

 

Thank you!

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2018

    If I am not mistaken, prior to the 14.3 release of Automator there were no Global Declarations available in Visual Processes.

     

    When I upgraded from 14.1 to 14.3 I found there is a new "scripting" tab under Visual Processes now which allows you to create Global functions and classes.  You will also need to add your Imports / Assembly References in the new "scripting" tab.

     

    Also check out the new "Api.AddVariable" command that allows you to create custom macros ( &[script.yourVariable] ) in your scripts that can be used later in objects like distributions, exports, etc..., very useful!

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2018

    Thanks Thomas, that helps.

     

    I'm on 14.1 now.

    Just out of curiosity, was it a smooth upgrade from 14.1 to 14.3?

    I'm assuming the processes still work the same was after upgrade.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2018

    Thanks Thomas, that helps.

     

    I'm on 14.1 now.

    Just out of curiosity, was it a smooth upgrade from 14.1 to 14.3?

    I'm assuming the processes still work the same was after upgrade.

    All of my process configuration came over fine with the upgrade to the 14.3 release.

     

    As usual, I had to reset the password and reconfigure Active Directory Integration manually after the upgrade.

     

    After the release upgrade, I proceeded to install the latest Cumulative Update.

    I ran into an issue applying the MS-20171222-14.3.1.22721-CumulativeUpdate_x64.zip to the base 14.3 install.  At first after applying the cumulative update, the Agent service would not start.

     

    It turned out that Internet Explorer marked the zip file as blocked "downloaded from an external source" and I hadn't unchecked it on the properties tab of the zip file.  So when I extracted the zip it had marked some of the DLLs the same way.  I believe in my case it was Datawatch.Data.Database.MSSQL.dll in the Agent folder. So that dll was marked by the operating system as blocked from execution.

     

    The solution for this was to click "Unblock" on the properties -> General tab of the zip file before extracting it (or could have been done on the DLL itself after the fact if I'd realized what the problem was at the time ).  After this the Agent service started fine.

     

    Once I had the upgrade and cumulative update in place, at first my Visual Process scripts were broken, because I didn't copy my Imports / Assembly References to the new Visual Process area.

     

    Once I added all the same Imports / Assemblies from the old "Process -> Scripts" to the new "Visual Process -> Scripts" they were working again as before.

     

    Since then no issues on my existing standard Processes or Visual Processes.

     

    I have run across a problem in certain Visual Processes while trying out the new "Api.AddVariable" feature... if there are looping structures in your code like timers, or possibly even on some branching structures, it could stop the process if you call Api.AddVariable before it hits the loop / branch, returning an error in the process "collection was modified, enumeration operation may not execute". 

    I've worked with Datawatch technical support on this and it's my understanding this is currently categorized as a defect in the new feature which they intend to have fixed on the next update or so.

    My current work-around for this is to make sure I only use Api.AddVariable after any looping / branching structures in the Visual Process.  If I need to get a variable value earlier on, I can use Api.AddRuntimeFieldValue in the beginning of the process, then pass that value into an Api.AddVariable later in the process so that I can use the scripting macros with the value.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2018

    All of my process configuration came over fine with the upgrade to the 14.3 release.

     

    As usual, I had to reset the password and reconfigure Active Directory Integration manually after the upgrade.

     

    After the release upgrade, I proceeded to install the latest Cumulative Update.

    I ran into an issue applying the MS-20171222-14.3.1.22721-CumulativeUpdate_x64.zip to the base 14.3 install.  At first after applying the cumulative update, the Agent service would not start.

     

    It turned out that Internet Explorer marked the zip file as blocked "downloaded from an external source" and I hadn't unchecked it on the properties tab of the zip file.  So when I extracted the zip it had marked some of the DLLs the same way.  I believe in my case it was Datawatch.Data.Database.MSSQL.dll in the Agent folder. So that dll was marked by the operating system as blocked from execution.

     

    The solution for this was to click "Unblock" on the properties -> General tab of the zip file before extracting it (or could have been done on the DLL itself after the fact if I'd realized what the problem was at the time ).  After this the Agent service started fine.

     

    Once I had the upgrade and cumulative update in place, at first my Visual Process scripts were broken, because I didn't copy my Imports / Assembly References to the new Visual Process area.

     

    Once I added all the same Imports / Assemblies from the old "Process -> Scripts" to the new "Visual Process -> Scripts" they were working again as before.

     

    Since then no issues on my existing standard Processes or Visual Processes.

     

    I have run across a problem in certain Visual Processes while trying out the new "Api.AddVariable" feature... if there are looping structures in your code like timers, or possibly even on some branching structures, it could stop the process if you call Api.AddVariable before it hits the loop / branch, returning an error in the process "collection was modified, enumeration operation may not execute". 

    I've worked with Datawatch technical support on this and it's my understanding this is currently categorized as a defect in the new feature which they intend to have fixed on the next update or so.

    My current work-around for this is to make sure I only use Api.AddVariable after any looping / branching structures in the Visual Process.  If I need to get a variable value earlier on, I can use Api.AddRuntimeFieldValue in the beginning of the process, then pass that value into an Api.AddVariable later in the process so that I can use the scripting macros with the value.

    I have Automator running on a virtual machine, I picked a time for the upgrade when I didn't expect any ingestion files to arrive and I did a snapshot before the upgrade.  If you have Automator server running as a VM it's probably a good idea to take advantage of the snapshot technology before the upgrade.  I did have to revert to my snapshot and retry the cumulative update a few times before we figured out what was causing the problem.  Technical Support was a great help during this.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2018

    I have Automator running on a virtual machine, I picked a time for the upgrade when I didn't expect any ingestion files to arrive and I did a snapshot before the upgrade.  If you have Automator server running as a VM it's probably a good idea to take advantage of the snapshot technology before the upgrade.  I did have to revert to my snapshot and retry the cumulative update a few times before we figured out what was causing the problem.  Technical Support was a great help during this.

    One more bit of an annoyance in 14.3... if you use groups in your visual process.  I have some complex processes that do.

     

    If the items inside your group are larger than the original process overview, you won't get scroll bars to allow you to move through the process.

     

    As a work around I add a temporary blank credentials object at the main process level and drag it way to the bottom right of the screen and keep going to expand the size of the main process and scrollbars to accomodate what I need later on when I am inside the group. That way the scroll bar functions once I'm working inside the group.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2018

    One more bit of an annoyance in 14.3... if you use groups in your visual process.  I have some complex processes that do.

     

    If the items inside your group are larger than the original process overview, you won't get scroll bars to allow you to move through the process.

     

    As a work around I add a temporary blank credentials object at the main process level and drag it way to the bottom right of the screen and keep going to expand the size of the main process and scrollbars to accomodate what I need later on when I am inside the group. That way the scroll bar functions once I'm working inside the group.

    And, also related to grouping... I think this is a known bug... there are problems sometimes re-configuring certain objects inside the group. If I recall correctly I experienced when putting a blank model inside a group, I was not able to come back to the process later after the initial process configuration and edit the object while it was inside the group to point it to a model.  Work around being to delete that object, create new one outside the group, configure it, and then move it in to the group.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2018

    One more bit of an annoyance in 14.3... if you use groups in your visual process.  I have some complex processes that do.

     

    If the items inside your group are larger than the original process overview, you won't get scroll bars to allow you to move through the process.

     

    As a work around I add a temporary blank credentials object at the main process level and drag it way to the bottom right of the screen and keep going to expand the size of the main process and scrollbars to accomodate what I need later on when I am inside the group. That way the scroll bar functions once I'm working inside the group.

    Thanks a ton Thomas, your response is very through and informative.


    I've recently started using Monarch and haven't explored a lot of features.

    Most of my standard and visual processes are very basic, haven't used groups or timers yet.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2018

    Thanks a ton Thomas, your response is very through and informative.


    I've recently started using Monarch and haven't explored a lot of features.

    Most of my standard and visual processes are very basic, haven't used groups or timers yet.

    I've only been using Automator for a little over a year now, but I have had a lot of time during this year to focus on learning it and getting the most I can out of it.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2018

    I've only been using Automator for a little over a year now, but I have had a lot of time during this year to focus on learning it and getting the most I can out of it.

    Thomas,

     

    Great posts!

     

    Extremely useful.

     

    They remind me a lot of how regularly vibrant a much older version of the User Forum used to be some time ago. These days is seems to be like that in fits and starts. Perhaps the user demographic has changed significantly.

     

    It would be really great to bring things back up to at least a simmer if not a full on boil!

     

    After a year of exposure to Automator and Monarch how are you finding it as a tool for your business needs?

     

    Grant

     

    (A long time User not a staffer!)