Configuring gateway scripting project

I have a gateway, and in that gateway I have four projects (say Cell1, Cell2, Cell3, Cell4). Each cell will have its own perspective session and the cells will be identical except for which UDT (Cell) its referring to. I want to put some tag event scripts based on ValueChanged. I understand that I have to change the gateway scripting project setting under gateway settings in order to run scripts within the project. I have a session property which I use throughout the program in order to change the UDT of the cell I want to access. Am I wrong in thinking that I need four separate projects, one for each cell? And if I have the four projects how would I set up the gateway so all four projects/sessions would have access to only one gateway scripting project?

Why use tag event scripts? Use a gateway-scoped tag change script; they still live in the project, so you don’t need to worry about the ‘singleton’ gateway scripting project setting.

1 Like

I see. With that being said how would I allow it to be modular meaning if I am evaluating the value of say tag [Cell1]Control/Recipe for Cell1 session and tag [Cell2]Control/Recipe for Cell2 session, how would I make [Cell1/Cell2] be a variable within the tag call? Again I do have a session property “session.custom.CellId” that I am using the change the tag path between different cells.

You can’t make the gateway scoped tag change script dynamic. A lot of people here will say to use those instead of tag event scripts inside your datatype, but for some, you have to use it since gateway scoped tag change scripts can’t be dynamic. We have over 125 instances of a data type and there is no way we would maintain 125 individual scripts in a gateway scoped event.

So our workaround is to use project inheritance. Make a 5th project called “Master” or “Global” and have your 4 cell project inherit that project, set that as your scripting project.

This is a misunderstanding of the features of gateway tag change events. They aren't one-for-one like tag events. A single gateway tag change event script can subscribe to all 125 UDT elements. The only additional maintenance when creating UDT instances is to drag the appropriate tag path into the event's subscription list. Small price to pay to gain the advantages of project-scoped tag change events.

1 Like

Does this mean that I can somehow not have to make a “global” project to have the script work for the individual cell projects?

Since everything you’ve described requires the cells to be functionally identical, I would expect one single project to handle your entire setup. When designing your windows/templates/pages/views, include a tagpath property/parameter to point at the data that should be displayed for any given session. Use indirect binding everywhere.

Have you gone through all of the free online training at Inductive University? I think you’ll have a better grasp of the possibilities and can more wisely choose from the many different ways to approach your application.

Yes I am aware of using the indirect tag bindings and have incorporated them everywhere in my project so far. In order to reference the different cells I have a session custom property which I will use to differentiate between the different cells and I am using that in the tag provider area for each tag within the project. If I did use one project for all cells how would I dynamically add the ‘cell id’ to the session URL? Right now an example of the URL would be “http://10.224.3.25:8088/data/perspective/client/Cell_C2/CellSetup”. How would I dynamically change the ‘C2’ designation and how would I set up the different sessions to actually utilize that different cell id path?

You would include cell ID as a page URL parameter.

You didn’t answer whether you’ve done the online trailing, so I presume that’s a no. You’re probably going to continue fumbling around in the dark until you do.

I have completed about 70% of the training. The training still left has to do with things I don’t need to worry about for this project. Thanks for the advice about the page URL parameter. I will review that. I completed the training a while ago so not everything is fresh in my head from then.