Does `commit DataGroups 1` have effect?

51 views
Skip to first unread message

Hongbo Miao

unread,
Dec 11, 2024, 10:23:15 AM12/11/24
to IADS

Hi IADS team,


In Python, I can update DataGroups by

iads_config.Query(f"update DataGroups set * = |||{group_name}|{signal_list}|")

which works great.


I am wondering does this one has any real effect? Is there document for specific for how `commit` works?

iads_config.Query("commit DataGroups 1")


Thanks

Hongbo

Hongbo Miao

unread,
Dec 11, 2024, 4:37:09 PM12/11/24
to IADS
I understand more how it works now.

Solution 1
When I use Iads.Application, I would need do something like
import win32com.client

group_name = 'TestGroup'
signal_list = 'signal1,signal2,signal3'
iads = win32com.client.Dispatch('Iads.Application')
iads_config = iads.Configuration
iads_config.SqlQuery(f"update DataGroups set * = |||{group_name}|{signal_list}|")
iads_config.SqlQuery('commit DataGroups 1')

Note it is using `SqlQuery()` and `commit DataGroups 1` inside.

Solution 2 (Cleaner)
When I use IadsConfigInterface.IadsConfig, I would need do something like
import win32com.client

group_name = 'TestGroup'
signal_list = 'signal1,signal2,signal3'
iads_config = win32com.client.Dispatch("IadsConfigInterface.IadsConfig")
iads_config.Query(f"update DataGroups set * = |||{group_name}|{signal_list}|")
iads_config.Save()

Note it is using `Query()` and `Save()` inside.

At https://www.curtisswrightds.com/capabilities/services/support/technical-rws/palmdale#UserGuides, download the zip file at "Programming Examples" -> "API" -> "IADS Configuration File Interface".
Inside the zip file, there is a file called "IadsConfigInterface.idl". Below is part of "IadsConfigInterface.idl" file. You can see it documents functions like `Query()` and `Save()`
interface IIadsConfig : IDispatch
{
//! Open an existing configuration file with create backup option.
/*!
\param PathAndName The full path and name of the configuration file to open.
\param CreateBackupFile Optional, determines if a backup file will be created.
*/
[id(1), helpstring("Open an existing configuration file with create backup option")]
HRESULT Open([in] BSTR PathAndName, [in,defaultvalue(-1)] VARIANT_BOOL CreateBackupFile) ; // VS2005: removed 'optional' for warning MIDL2400/MIDL2401 - defaultValue implies optional
//! Create a new configuration file with open option.
/*!
\param PathAndName Full path to the configuration file to be created.
\param OpenAfterCreate Determines if the newly created configuration file will be opened.
*/
[id(2), helpstring("Create a new configuration file with open option")]
HRESULT Create([in] BSTR PathAndName, [in] VARIANT_BOOL OpenAfterCreate) ;
//! Commit and save changes from open configuration file.
[id(3), helpstring("Commit and save changes from open configuration file")]
HRESULT Save() ;
//! Close configuration file with save option.
/*!
\param WithSave Optional, determines if the configuration file will be saved before being closed.
*/
[id(4), helpstring("Close configuration file with save option")]
HRESULT Close([in, defaultvalue(-1)] VARIANT_BOOL WithSave) ; // VS2005: removed 'optional' for warning MIDL2400/MIDL2401 - defaultValue implies optional

Just sharing this here in the hope that it helps others who visit in the future. ☺️

Thanks
Hongbo
Reply all
Reply to author
Forward
0 new messages