Cancel
Showing results for 
Search instead for 
Did you mean: 

How to reset user attributes on MUs the best way?

Valued Contributor
Valued Contributor

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 Phenom Siemens Phenom
Siemens Phenom
Considering to change line 53 of .Models.Frame.Method from: @.str_Attr:= obj_To_Rest.str_Attr to: @.setAttribute(str_Attr,obj_To_Rest.getAttribute(str_Attr)) your method would work. I prefer to access user attributes in a more dedicated way which depends on the use case. For MUs circulating in the model a user attribute should either be reset after last time reading it or simply be left on the last value (in case you're sure it will be written before next read). Often these user attributes (counter, timestamps, ...) have to be reset on different points in the model, so a global reset doesn't make sense. For MUs travelling throughout the model there is normally no need to reset, if yes, see above.

Regards

Always consider using the AttributeExplorer!

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

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello Jfinnberg,

You also can create a custom attribute of type method with name 'Reset' at the MU class.

This method will be called on reset, so this is the ideal place to reset your instance attributes.

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.