Sample project scripts for Ignition 8.1

Hi,

New to Ignition.

Appreciate if there is any source or sample functions that can be done and way to do it in the scripting project library. Need to write functions that would read tag values, process them and return the results.

Regards,
Sameer

In this case, I create a function that sends target values based on input params.

Then call this function in tag change script.

Make sure to set the Gateway Scripting Project.

Thanks for the reply @nideyijuyidong

Writing to a tag through the script. But the tag value is in error.

Because system.tag.readBlocking return a list of Qualified objects . Use val[0].value instead.

  • Returns

List - A list of QualifiedValue objects corresponding to the Tag paths. See Scripting Object Reference.

1 Like

That worked. Appreciate you help @nideyijuyidong

If I may, 2 ways of making that script a bit simpler:

if season_mode_code in [0, 1, 2]:
    JiJieMode = 1 if season_mode_code == 1 else 0
    GuoDuMode = 1 if season_mode_code == 2 else 0
    # tag write code

# OR

JiJieMode = 0
GuoDuMode = 0
if season_mode_code == 1:
    JiJieMode = 1
elif season_mode_code == 2:
    GuoDuMode = 1
else:
    return
# tag write code

Yes, that could be easier. I keep them in this style, because it follows the format of the logic document(about how the equipments work). my unprofessional programer colleagues would easily understand this in the future.
Haha, I hope my colleagues who have never touched Python can at least understand what the script is doing.