Problems when exporting many tags

good morning everyone,

is there any way to export a large number of tags in a single export?

I receive a time out message and then an empty file is created.

image

in this case you would need to export the entire PROJECT folder

image

Thanks,

There's a hard limit of 60 seconds for requests to a gateway from the designer. If assembling and transmitting the export takes longer, there's no way to do it with the GUI. Your alternative would be to use the system.tag.exportTags() scripting function in a "fire-and-forget" gateway message handler. Then retrieve the file from the gateway's file system.

3 Likes

Hi Phil, thanks for replying.

I don't think it's working, please correct me if I'm doing something wrong.

thanks

Maybe split the export into several smaller batches, so that you don't timeout ?

I think the best option I got was to split the parts as you say, then I thought that the script will be executed when the ignition is turned off (gateway events), so I will have a backup of the folders every time the system is turned off.

# Define the file path where you want to export the tags
filePath = "C:/Users/mcimildoro/Downloads/tags.json"

# Define the list of tag paths you want to export
tagPaths = ["[BALEN]PROJECT/BESS/BESS_1", "[BALEN]PROJECT/BESS/BESS_2",  "[BALEN]PROJECT/BESS/BESS_3"]

#Export the specified tags to the specified file path
result = system.tag.exportTags(filePath, tagPaths)

thanks for your answers

You are running in the scripting console. That is not gateway scope, so is subject to the same hard timeout as anything else in the designer.

You didn't put this operation in a gateway message handler as I instructed, so it didn't work. :man_shrugging:

1 Like

understood, I have made the script in the same gateway event but I have not received any download of the test file, I guess it is because the gateway will have its own internal download file, in this case in the virtual machine where Ignition is installed.

Does C:/Users/mcimildoro/Downloads/ exist on the gateway server? If so, does the gateway service have access to that folder (unlikely)?

The gateway service does not have access to any client-side file systems. You must place the file in a folder the gateway can write into.

You would then use your network to copy the file from the gateway back to your client.

Also, print in gateway scope doesn't show up anywhere except in the gateway's wrapper log (the text file), not in any other logs.

I have been trying with other options and apparently it is not exporting the json format, the path I am using is "C:/", it is exporting .txt documents with a print inside the file and it does it perfectly, but when I try to export it with a json it does not do it.

now the problem is not path :sweat_smile:

Use the script console with a tag path that yields a small export for test purposes. Adjust until you are sure you have all of the function arguments just right. Then try that exact combination in the gateway message handler. When that works, shorten the folder hierarchy a little and try again. Repeat until you have the big export.

{ When running the big export, make sure you wait a few minutes, as you already know it takes more than 60 seconds.

Consider using a logger in your message handler so you don't have to watch the wrapper log. }

2 Likes

thanks Phil, in the end the problem I had is that I had not detailed the documentation, and I noticed that the path should be in double "//" and I was missing a last argument of the exportTags method. now it works.

# Define the file path where you want to export the tags
filePath = "C:\\Backup_tags\\PROJECT_31-08-2023.json"

# Define the list of tag paths you want to export
tagPaths = ["[BALEN]PROJECT"]

result = system.tag.exportTags(filePath, tagPaths, **True**)

thanks again for your contribution