"Must know" Scripting functions

hi there,

I’m getting started with the Scripting Functions in Ignition and wondered what are according to your experience the “must know” Scripting functions?

Thanks in advance,

This depends heavily on the project needs, however the system.tag and system.db are definitely used a lot. I don’t try to memorize them, but eventually you will anyways after enough use. This link is my go to, Scripting Functions - Ignition User Manual 8.0 - Ignition Documentation. I start a project then if I need a certain function, I just browse the list to see if it exists. If so, the function definition has the syntax and usually some useful code snippets. You can also type system.tag then press ctrl+space and a list of functions in that family will popup. Good luck :slight_smile:
P.S. make sure you checkout www.inductiveuniversity.com too if you haven’t yet


As @dkhayes117 mentioned, the “must know” scripting functions will vary from project to project. For users developing any sort of inter-client communication, I highly recommend system.util.sendMessage() and system.perspective.sendMessage(). For beginners, you will also definitely want system.util.getLogger() so that you can easily print out values as you go.


To tack onto what @dkhayes117 said, specifically in system.db you will absolutely want to use system.db.runPrepUpdate over the other update function. It sanitizes text and dates for you and the added benefit of protecting you from SQL Injection attacks. Saves a lot of headaches.

Also, not really a scripting function but an advice about scripting in the general, please avoid the “Magic Push Button” Anti-Pattern. I see it in lots of projects - a button is the single source of all the business logic for submitting a form or doing some operation. This is a really bad idea, and I would highly recommend to create your own functions that are then called by this button. A few reasons why - what if another part of your application needs to call the same business logic? And now say you did have the same logic copy and pasted in two different spots and a new developer is tasked with changing the logic, they may not be aware of the other instance. This is just a real big pet peeve of mine, I’m still fixing the main application I work on to get rid of this anti-pattern, but the easiest thing to do is to just never do it in the first place.


thanks @dkhayes117, @cmallonee and @bkarabinchak.psi for the advises. I’ll definitely check them out!
Is there a place to find some real world examples where similar scripts are used?

The link of the scripting functions page I posted will have examples of each. But here are a couple of examples.
read the value of a tag. A tag read is a fully qualified value with tag quality, value, and timestamp. Add the dot value at the end to get just the value portion like so,

myTagValue = system.tag.read('myTagPath').value

Writing to a tag

value = 10

DB insert with named query and refresh table that is bound to that DB table

params = {"DowntimeValue":DowntimeValue, "StartTime":StartTime, "EndTime":EndTime, 'Input':Input, 
			'shiftone':shiftone, 'shifttwo':shifttwo,'shiftthree':shiftthree,}
system.db.runNamedQuery("DownTime/DT_ManagerEntry_R1", params)
table = event.source.parent.getComponent('Power Table')
system.db.refresh(table, "data")

Any other situations you want to see an example of?
you may also want to reuse functions that you have written,
if you create a project based function you can call it like so,


Not sure about Ignition 8.0, but in 7.9 you can have shared functions that can work in any project

1 Like

Something to note,


are deprecated functions in 8.0, look for the synchronous and asynchronous 8.0 equivalents:




First you should have a problem to solve then you will automatically start looking for appropriate functions, whether it’s data base or client UI or tag related . Other approach is to browse thru all functions then you will have a vague idea of all that’s supported then delve deep into those that are required to solve your problem. That’s my approach but might have hardly used 10% of all of its potential!


Well, I’d say “all of them”, but I have to admit never using system.math.kurtosis. :neutral_face:


thanks @pturmel
which scripting functions do you use more frequently?

It’s less to do about functions and more to do about the functions you make yourself using Ignitions functions and business logic. You didn’t mention how well you know python in OP. When I started I didn’t know anything. Not that I am all that great now.

But, as @bkarabinchak.psi said to avoid doing things over and over again. I totally fell into this trap early. If I think I might do this again, whatever it is I am doing, It goes into a shared script of some sort… https://docs.inductiveautomation.com/display/DOC80/Scripting+in+Ignition#ScriptinginIgnition-ProjectScripts

If you’re messing with perspective a lot. Setting up a good strategy for pop-ups, that you’ll call through functions and passing params, would’ve been really good advice for me. For sure.

1 Like

Named queries, bulk tag reads & writes, logger, invoke*. Occasional use of OPC functions.

This applies equally to Vision as well