cancel
Showing results for 
Search instead for 
Did you mean: 

How to reset user attributes on MUs the best way?

Pioneer
Pioneer

Hello
I have a number of diffent user-attributes that I whant to reset the values on. is it possible to use one method that can reset the values on diffent types of MUs to the default values of respective Class? I have 

@.putAttributeNamesIntoTable(tab_attrlist,true,false)
@.putAttributeNamesIntoTable(tab_noUserAttrList,false,false)

to get two diffrent sets of tables containing the name of attributes.then I remove all standard attributs from the table that contains all attributs and left is a list (string) of the User defined attributes. 

see modell

Is it possible with a method or is it easier and better just delete the instans and create a new? 

 

 

2 REPLIES

Re: How to reset user attributes on MUs the best way?

Siemens Genius Siemens Genius
Siemens Genius

Dear Jfinnberg,
I would recomend you to have look at the methods 'getAttrValue','getAttrNo','getAttrName','setAttrValue' and 'numAttr'. These methods allow you to access the user-defined attributes directly without the detour of the tables.

 

var obj: object:=@.class
for var i:=1 to obj.numAttr loop
    --if you only want to use the original class to reset values
   @.setAttrValue(i,obj.getAttrValue(i))
   --if you want to use a different object to overwrite the values, you have to be sure the attribute exists for both objects
/*
var attrName:=obj.getAttrName(i)
var attrNo:=@.getAttrNo(attrName)
if attrNo/=0 then
@.setAttrValue(attrNo,obj.getAttrValue(i))
end
*/
next

 

I hope this is what you were lookin for.
Regards,
Tim

Re: How to reset user attributes on MUs the best way?

Pioneer
Pioneer

Thanks

was exactly what I was after

 

Br Jfinnberg