I seem to be having a heck of a time getting some of the functions listed in the docs. to work. For example, in a script module toStr or toString do not work, yet the Python operator str does for converting something to string. The same for things like toDate and such: I alway get a name error. However, functions work fine as long as I use the correct import statement. What gives?
You’re making a common mistake: mixing the expression language and the scripting functions. They are not the same thing. The functions defined in the expression language section cannot be used in scripting; they’re for use in expressions.
It may help to understand the context. Consider MS Excel by comparison.
When you type “=” then something in a cell you are using their own invented expression language. Ignition expressions are similar. Instead of a cell, you would use an expression for a property value or tag.
When you create a Macro that performs some functionality on an action (say button press), you are scripting. In Excel this uses VBA, which is different from their expression language. Ignition uses Python for scripting. Ignition scripting is for actions (button press) or events (logon, Function key, periodic timer).
There are functions that have been provided for you within Ignition. You get both Expression and Scripting fuctions. Check out “Appendix B - Expression functions” and “Appendix C - Scripting Functions” in the user manual to get a feel for it.