ELEMENT_ID

Find and share HowTos to various installations / configurations!
Search

Post Reply
6 posts • Page 1 of 1
giorgiob
Posts: 31
Joined: Fri Sep 07, 2018 12:53 pm

ELEMENT_ID

Post 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.

User avatar
leoknipp
Posts: 2926
Joined: Tue Aug 24, 2010 7:28 pm

Re: ELEMENT_ID

Post 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

giorgiob
Posts: 31
Joined: Fri Sep 07, 2018 12:53 pm

Re: ELEMENT_ID

Post by giorgiob »

Ok, but how to calculate ELEMENT_ID? Maybe:

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

?

giorgiob
Posts: 31
Joined: Fri Sep 07, 2018 12:53 pm

Re: ELEMENT_ID

Post by giorgiob »

Is it correct?

ngloeckner
Posts: 1
Joined: Fri Jan 20, 2017 1:59 pm

Re: ELEMENT_ID

Post by ngloeckner »

I think so. The formula seems right, because my results are correct.

User avatar
leoknipp
Posts: 2926
Joined: Tue Aug 24, 2010 7:28 pm

Re: ELEMENT_ID

Post 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

Post Reply
6 posts • Page 1 of 1