Where should I save some permanent information?

I'm working in a small app.
One of the things that it does is creating an excel. It makes a sheet called Instructions with data that is not going to be modified.

Where should I save that information?
I don't feel like writting it in a script file is correct. At the end is going to be something like a dataset.

[
    ["Step", 1, "Do something", "info1"],
    ["Step", 2, "Do other thing", "info2"]
    ...
]

Then I simply do a foor loop writting each value in each cell. Where should I save that information? I have about 70 rows and 7 columns.

Thx in advance!

I would use a database, do you have a db connection available?

I would prefer not to use one. We want to be a simple "import project" with little to no configuration. Setting a db would add complexity that I would prefer not to have.

My first thought was a .txt file that is inside the project.


If you want to avoid using a database, You could store it in a memory tag as Document, or Dataset for the data type

You could also use a dictionary held in the top-level of a project script. You can search on the forum about using system.util.getGlobals() for such a thing.

I would have to create it first. And I would need that information to create it.

You would create an empty dictionary at first and populate it later.

1 Like

You can always use a sql lite db connection through ignition will will just write to a file for you. No installs required.

If you intend to get information out of this .txt file in a structure way (like a list of lists like in your example) you will need be creating a lot more work for yourself to correctly right and read from that than it would be to setup a sql lite database. I would consider this a foot gun. Use a memory dataset or document tag, top level variable, or a sql lite database - all these already solved writing/reading structured data.

1 Like

It’s a small dataset. I’d use a dataset memory tag, and lookup() whatever I needed.

3 Likes

How would I initialize the tag when importing the project?

Is this in Vision, or Perspective?

  • Vision: use a client tag
  • Perspective: put it in a session property.

EDIT: Sorry, someone was speaking to me about actual work stuff :roll_eyes: The nerve…

Either way, you can do a lookup(), wherever the dataset is stored.

1 Like

Neither of those.

It's a scripting project that it's called from the scripting console.

(is for managing tags and having a control over it, not mean to stay)

Why don’t you describe the problem you are trying to solve

1 Like

Uh, no.

That is Vision scope.

Permanent information in the gateway will not be directly available in Vision scope. You will need to use database queries or system.util.sendRequest().

I'm building an Excel with some sheets using apache poi libraries.

The first page is some instructions that are fixed.
Second page is the data of the selected provider (formatted or with different things).

The second page is really easy, because I get the data from the provider.
First page is more difficult because I don't have the data stored.

We have a need that the project won't need configuration. So you simply import, and it's ready to use.

My question is, where should I (or can I) save the information of the first page?

My current thought process:

  1. A .txt file inside project → Can't because doesn't get exported with the project
  2. A bd table → Can't because It would need bd configuration from the user
  3. A file tag → Doesn't get saved when exporting the project
  4. A scripting file with a dataset → Current solution that I'm thinking is the one i would use

I am guessing it’s control flow logic on excel sheet page 1 given your example? In which case it should be in your code directly anyways imo. If its not you need to be more specific.

1 Like

Nope, it's instructions on how to use the second sheet. I'll paste an example:

Explain on how to configure the second sheet so you can use propertly the tool we are designing.

And where are the users going to see this, in vision or perspective? And if they are not, why does it need to be in the project at all, seems more like documentation?

It's going to be in an excel that the our tool is going to create from scratch. You execute a function in the designer console and automatically it's going to create a xlsx file with all the data I just described before.

So there shouldn't be any config, but then the user is expected to open the designer to actually run things ?

There's something not quite right here...

4 Likes