08-21-2022 10:13 PM
Hi folks,
I'm trying to figure out how to directly access the property objects within TestStandDatabaseSchemas.ini.
Does anyone know which API method to use to accomplish this?
I've been trying methods like GetEngineConfigFile and ReadPropertyObjectFile, and I haven't had any luck yet.
I guess as a last resort I could make a parser, but I'm hoping to find the official way to do this.
Context:
Years later I am still trying to figure out how to programmatically load a database schema so that the user never has to worry about this being configured correctly. This has historically been a headache and I'm trying to automate it.
Since the TSDBOptions methods are mostly undocumented, my thought process is loading the schemas into a property object and then using the contents to directly set up a schema at runtime from within the plugin.
Thanks in advance for anyone's input.
Mr. Jim
Solved! Go to Solution.
08-22-2022 01:03 PM
Mr._Jim,
The code uses PropertyObject.ReadEx and PropertyObject.Write to create and update the file. The object names are "DatabaseOptions" and "DatabaseSchemas";
Note: This can change in a future version of TS but there are no immediate plans to change it.
Hope this helps,
Regards,
Anand Jain
NI
08-23-2022 10:56 PM - edited 08-23-2022 10:59 PM
Anand, this is great! It was the mystical secret I was missing.
Thanks!
For anyone attempting to do this...
Locals.DatabaseSchemas.ReadEx( Parameters.TestStandDatabaseSchemaFilePath,0,ConflictHandler_Error)
In this case, Locals.DatabaseSchemas must be an array of NI_DatabaseOptionsSchema
At first I made the mistake of trying to use that type, but not as an array.
Mr. Jim