How to get / generate XID for PointEventDectors table?
-
We're looking to use a query such as:
INSERT INTO POINTEVENTDETECTORS (
XID,
ALIAS,
DATAPOINTID,
DETECTORTYPE,
ALARMLEVEL,
LOWLIMIT,
HIGHLIMIT,
DURATION,
DURATIONTYPE,
BINARYSTATE,
MULTISTATESTATE,
CHANGECOUNT,
ALPHANUMERICSTATE,
WEIGHT
) VALUES (
'PED_000001',
'Testing1',
'132',
'12',
'1',
'18.0',
'24.0',
'5',
'1',
'N',
'0',
'2',
'',
'0.0'
), (
'PED_000002',
'Testing2',
'132',
'12',
'1',
'17.0',
'25.0',
'5',
'1',
'N',
'0',
'2',
'',
'0.0'
);...to insert point event detectors, however we can't seem to figure out where the XIDs are coming from? Any advice? Thanks!
-
This seems like a less than ideal thing to do as you'll be bypassing the various Mango layers. Can you share what your use case would be or why you want to do this? The XIDs are randomly generated but need to be unique within the whole system.
A much better method would be to use our RESTapi. I don't think we currently have a option for creating Event detectors but we intend to adding in features like that.
-
Need to add hundreds, possibly thousands of event detectors and don't want to do it manually. We use macros, etc... to generate SQL queries based on point lists in Excel. This allows us to instantly setup the points, histories, event detectors, etc... without having to do the work.
If there's a better way, please advise.
-
In general doing direct database actions like this are not a good idea. If you were to do direct database inserts you would at least need to reboot Mango after to get all the changes loaded into Memory.
The right way to do this is through our RESTful API. The feature isn't available right now but this is something we could add for you in the near future. You can contact us at support@infiniteautomation.com for more details.