ARIS Day Switzerland (German)
Register
ARIS Process Mining in action - Live Demo
Register

View all
PH

Hi all,

I've tried to set the value of an attribute of the type enumerator in a macro.

I tried the methods

Designer.setAttribute(myModel, myObj,Constants.AT_SAP_FUNC_TYPE, "Process", null)  and Designer.setAttributePersistent(myObj, Constants.AT_SAP_FUNC_TYPE, "Project", null)

The result was that in the first case, although no error was thrown, the attribute value remained unchanged. In the second case an error was thrown stating that an parameter of type String was passed instead of Integer. This error message doesn't make much sense: When I tried exactly the same statement with the attrTypeNum "AT_SHORT_DESC", it worked flawlessly.

When I try to do the same in a report by the following statement, the attribute is set without any problems:

ObjDef.Attribute(Constants.AT_SAP_FUNC_TYPE, Context.getSelectedLanguage).setValue("Process")

Does anyone know whether there's a different way to set the value of enumerator attributes in a macro? Or has someone experienced a similar problem?

Thank you and best regards,

Philipp

by Martin Schröder
Badge for 'Contributor' achievement
Posted on Wed, 10/13/2010 - 15:28

Hello Philipp,

I am afraid, the error message "string instead of integer" is right,  but it refers to the rather hidden explanation in Aris Script Help: search for AT_SAP_FUNC_TYPE leads to the topic "Constants from AttrTypeTblNum". For an attribute of the type enumerator the list of allowed values consists again of numeric constants (attribute value types AVT_*), whereas you tried to set the attribute value to the strings "Process" or "Project".

For your purpose you should use AVT_PROC_1 (Process) or AVT_SOLAR_PROJECT (Project) resp. in macros.

Perhaps this holds strictly only for macros as Aris Script Help states for the setValue() method in report scripting (s. Help topic "Report class Attr - Method setValue") a more lax usage of strings instead of constants for numeric attribute value types.

"AT_SHORT_DESC" worked all right, because it is a string attribute.

Hope this helps, Martin

0
by Philipp Hess Author
Posted on Fri, 10/15/2010 - 14:08

Hi Martin,

Thanks a lot - that explains of course why I wasn't able to set the value! I didn't see through, but thanks to your reply it's clear now.

Best regards,

Philipp

0
by Nicolás Pozo Rojas
Posted on Tue, 09/06/2011 - 16:39

Hi,

I'm dealing whit a similar problem,

I can't set de Attribute Value of  AT_SAP_MOD_TYPE with null value. 

modelVAC.Attribute(Constants.AT_SAP_MOD_TYPE).setValue("");

How can I set the default value?

Thanks!

0
by Philipp Hess Author
Posted on Wed, 09/07/2011 - 10:04

Hi,

Have you tried the delete-function?

modelVAC.Attribute(Constants.AT_SAP_MOD_TYPE, [LOCALE]).Delete()

In general: If you set the the value of an attribute to an empty string, it's still considered as maintained. So if you run searches, this can be an issue.

I hope this helps you solving the problem.

0
by Radek Laža
Posted on Fri, 08/14/2020 - 15:26

Hello All,

eleven years later I have found this thread and I think that it would be good to extend it. What Martin has demonstrated is how to set the Built-in Attribute Value Type using Macro. Maybe it is obvious, but for Custom = User Defined Attribute Value types, you can use following approach.

I use this code to set certain custom attributes to default values when new object occurence is dropped to the model.

var oNewObjOcc = Context.getSelectedObjOccs()[0];
var oModel = Designer.getModel(oNewObjOcc);
// Get Current Object Occurence and then Model in which we are dropping that occurence

var oNewObj = Context.getSelectedObjects()[0];
// Get Object definition object to which the dropped Occurence belongs to

var metamodel = Context.getArisMethod();
// Attributes and Attribute values are defined in ARIS method, not in the DB or any actual model. var metamodel is defined to access that info

var intAttRef = metamodel.UserDefinedAttributeTypeNum("00000000-0000-0000-0000-000000000000");
// As you will read around this forum, it is better to work with GUIDs as they can be moved between servers. Find it for your custom Attribute Type in Administration/Configuration/Method/Attribute Types/API Name, this will return Type Number integer

var intAttValRef = metamodel.UserDefinedAttributeValueTypeNum("00000000-0000-0000-0000-000000000000","11111111-1111-1111-1111-111111111111");
// Similar approach for Attribute Value, you just need GUID of Attribute Type same as above, and GUID of Attribute Type Value. Get it from Edit Attribute Type/Values and symbols/GUID for each defined value.

Designer.setAttributes(oModel,oNewObj,intAttRef, intAttValRef, null);
// with all this prepared you can finally set the value, note that I am not bothering with Language param, null = DB language

I have spent nice 3 days trying to figure out how to set custom attribute values that don't have built-in Constants via Macro and was mislead by the documentation Macro Class Designer - Method setAttribute that says: int--attrTypeNum and Object--value, where it actually should be understood as that both 2nd and 3rd parameters are actually integers when using custom attributes.

Hope it helps somebody.

0

Featured achievement

Genius
You like to help others solve their problems by answering questions.
Recent Unlocks
  • KF
  • KH
  • RG
  • Profile picture for user Vee_ARIS
  • Profile picture for user smarty
  • PacMan

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock