Page 1 of 1

ELEMENT_ID

Posted: Thu Jan 24, 2019 2:43 pm
by giorgiob
I need to retrieve, through a CTRL script, the ELEMENT_ID of the ELEMENTS table in RDB archive.

dpGetId() retrieves dp_id and dpe_id, but how do I get sys_id and how do I combine them to calculate ELEMENT_ID?

Thanks.

Re: ELEMENT_ID

Posted: Thu Jan 24, 2019 4:25 pm
by leoknipp
The system ID is the system number. The system number you can get with the function getSystemId() if you know the system name.

Best Regards
Leopold Knipp
Senior Support Specialist

Re: ELEMENT_ID

Posted: Thu Jan 24, 2019 4:36 pm
by giorgiob
Ok, but how to calculate ELEMENT_ID? Maybe:

ELEMENT_ID = dp_id * 0x1000000 + dpe_id * 0x100 + sys_id

?

Re: ELEMENT_ID

Posted: Thu Jan 31, 2019 10:37 am
by giorgiob
Is it correct?

Re: ELEMENT_ID

Posted: Wed Mar 13, 2019 3:08 pm
by ngloeckner
I think so. The formula seems right, because my results are correct.

Re: ELEMENT_ID

Posted: Fri Mar 22, 2019 10:57 am
by leoknipp
The information from the source code to calculate the ELEMENT_ID is

PVSSlonglong SQLParser::makeElementIDNr(unsigned long dpId,
long dpeId,
SystemNumTypeRDB sysID)
{
/*
PVSSlonglong elemID = (((PVSSlonglong) dpId) << 24) +
(((PVSSlonglong) dpeId) << 8) +
(PVSSlonglong) sysID;
*/
//cut out the first 8 bits
PVSSlonglong tSys1 = (PVSSlonglong) ( (PVSSlonglong) sysID & 0xFF);
PVSSlonglong tSys2 = (PVSSlonglong) (( (PVSSlonglong) sysID >> 8) & 0xFFFF);

PVSSlonglong elemID = (((PVSSlonglong) tSys2) << 56) +
(((PVSSlonglong) dpId) << 24) +
(((PVSSlonglong) dpeId) << 8) +
(PVSSlonglong) tSys1;
return elemID;

Best Regards
Leopold Knipp
Senior Support Specialist