Jump to content

Minor bug accessing gom.app.get('table.template_name') from script when opening a 2018 program in 2020


---
 Share

Recommended Posts

    I wrote a batch processing script to continually watch for and process STL's in a chosen directory. Recently we launched a ginspect program that was created in GOM 2018 that had a custom table template. We realized that the table export to CSV from 2020 was sorted incorrectly compared to the same program opened in 2018 when it was exported via the script. Manual export of the table worked fine so i knew it was something related to the script. After some debugging i found out that the custom table template that was created in 2018 returns an empty string when using the gom.app.get('table.template_name'). i assume since the scripting export function was getting an empty string it was defaulting to some other template. It never threw an error and still exported a csv , and  exported the custom table template correctly if i did so manually. Its just the script call to get the table name couldn't find that information. My assumption is that since the switch to the new package system, the way the information in the xml is structured has changed. Not being able to find the new tag or attribute name resulting in an empty string return.

    The solution was easy enough. Once the program was opened in 2020, start the edit mode for the current custom table template. You have to enter edit mode in a cell for the software to consider a potential change to the template even if you don't actually make one. Exit out of the edit mode and the current template will be labeled as user-defined. Click the save as template and overwrite the original custom template and everything is fine. I assume this processes re-writes the template in whatever format is currently being used in 2020.

    This topic is more of a heads up to those currently using custom table templates from and older version of Gom and dynamically referencing it via a script. Like I said there was no error, the csv exported just sorted incorrectly. The parts that were inspected nearly went out for additional work due to the formulas in a worksheet getting incorrect values. The sort issue was if an element was listed twice with different properties such as 'Element 99 with a property type of L' and 'Element 99 with a property type of dN' the order in which they appeared in the csv was reversed compared to what the table actually displayed in the software prior to export. That is what made it difficult to catch ahead of time. No error, and everything in the software showed the template was working as intended.

Link to comment
Share on other sites

Just found a package in the myGOM package repository that may be a good solution if there are several older programs. I haven't yet tried it but brings up another issue. I can download this package manually, but if I sign in through my open instance of the software and go to the package manager i receive an error.

bulkpackageupdater.jpg

image.png

Link to comment
Share on other sites

 Share

×
×
  • Create New...