Delete some configs of dpe by the script

Find and share HowTos to various installations / configurations!
7 posts • Page 1 of 1
Nikolay
Posts:34
Joined: Tue Aug 21, 2012 7:10 am

Delete some configs of dpe by the script

Post by Nikolay »

Hi to all!
At some point of developing our project, we set a lot of unnecessary datapoint functions and alert handling, but now we decided that it is no use for us and wish for cleaning para from unnecessary configs. But we have a lot of dpe-s and tags with it, so we are looking to a more quicker way to delete it by script, but still to no avail. Maybe someone has a solution? Thanks

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Delete some configs of dpe by the script

Post by leoknipp »

If a config shall be deleted you can simply do a dpSet() for the _type attribute with the CTRL constant DPCONFIG_NONE.
It is better to use a dpSetWait() in combination with getLastError() to check if an error occured.

Best Regards
Leopold Knipp
Senior Support Specialist

Nikolay
Posts:34
Joined: Tue Aug 21, 2012 7:10 am

Re: Delete some configs of dpe by the script

Post by Nikolay »

Wow, thanks a lot, will do!

Nikolay
Posts:34
Joined: Tue Aug 21, 2012 7:10 am

Re: Delete some configs of dpe by the script

Post by Nikolay »

Well, that didn’t work out as we expected. After we make dpSet with DPCONFIG_NONE, we looked in the PARA - and there was none dp_fct, but when we reopened script with dpNames by _dp_fct..fct - list of signals still contained deleted dp_fct.
Request of dp_fct: dpNames(tag+”:_dp_fct.._fct”);
or
dpNames(tag+”:_dp_fct.._type”);
Deleting: dpSet(tag +”:_dp_fct.._type”, DPCONFIG_NONE);

kilianvp
Posts:443
Joined: Fri Jan 16, 2015 10:29 am

Re: Delete some configs of dpe by the script

Post by kilianvp »

Whats the Value of _dp_fct.._type if do a dpGet? DPCONFIG_NONE?

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Delete some configs of dpe by the script

Post by leoknipp »

As written in my previous answer it is better to use dpSetWait() and getLastError() to get the information if the dpGet() worked.
Also please check the PVSS_II.log file to see if a log message was written.

If you want to delete specific configs you should probably check if the config is existing before trying to delete it, e.g. by using a dpQuery() with a WHERE clause.

Best Regards
Leopold Knipp
Senior Support Specialist

gschijndel
Posts:376
Joined: Tue Jan 15, 2019 3:12 pm

Re: Delete some configs of dpe by the script

Post by gschijndel »

Nikolay wrote: ↑ Mon Dec 13, 2021 1:22 pmwhen we reopened script with dpNames by _dp_fct..fct - list of signals still contained deleted dp_fct.

dpNames cannot be used to check if a config exists. For configs it will simply list all possible attributes of that config regardless if a dpe with specified or not.

7 posts • Page 1 of 1