« Back to Fachhochschule Nordwestschweiz FHNW

Naming of modelling elements

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Naming of modelling elements
Answer
11/23/16 8:32 AM
Hello

I noticed some "strange" behavior regarding the naming of modelling elements in the modelling toolkit and also have some questions.

Scenario: I use the existing class "Role" from the LearnPAd library to copy it to create several new specific Roles (e.g. Physician, Nurse). There is a different behavior for the naming if I choose Role as Superclass or the element above it (__S_group__). If I choose Role as Superclass (what I would like to do in order to inherit all relations), all elements are only called "Rolle" in the modelling toolkit and the name when double-clicking it is read-only eventhough when double-clicking the element, the name attribute actually says e.g. Role Acute Physician-23606 (this value can be changed but is not shown in the model). When choosing __S_group__ as superclass, this does not happen and the name in the model is then e.g. Role Acute Physician-23606. But then all relations are not inherited.
For some other elements I was able to do it without a problem but for some elements, this behavior happens. So there seems to be something wrong with "Role" I guess.

How can this be solved, that instead of "Rolle" the actual class name is shown?

For your reference, the code of the class "Role":

GraphRep:
 1
 2GRAPHREP
 3SHADOW off
 4
 5AVAL sp:"Language"
 6IF (sp = "System")
 7  IF (_uilang = "de")
 8    SET sp:"German"
 9  ELSE
10    SET sp:"English"
11  ENDIF
12ENDIF
13
14AVAL col:"fontcolor"
15AVAL set-default:"no" mono:"Monochrome view"
16IF (mono = "yes")
17  SET bMono:1
18ELSE
19  SET bMono:0
20ENDIF
21
22IF (bMono)
23  SET color_lightskyblue:(rgbval("white"))
24  SET col:(rgbval("black"))
25  FILL color:(color_lightskyblue)
26ELSE
27  SET color_lightskyblue:"lightskyblue"
28  SHADOW off
29  CLIP_ELLIPSE rx:.78cm ry:.68cm
30  GRADIENT_RECT x:-.75cm y:-0.75cm w:1.5cm h:1.5cm style:downdiag color1:(rgbval (color_lightskyblue, 1.4)) color2:(rgbval (color_lightskyblue, 0.7))
31  FILL style:null
32  PEN w:0.08cm color:(rgbval (color_lightskyblue, 0.7)) join:miter
33  CLIP_OFF   
34ENDIF
35
36ELLIPSE rx:.75cm ry:.65cm
37FONT color:(col)
38IF (sp = "English")
39   ATTR "Name" y:.8cm w:c:2.8cm h:t
40ELSE
41   ATTR "Bezeichnung" y:.8cm w:c:2.8cm h:t
42ENDIF
43
44FONT "Arial" h:32pt color:black
45TEXT "R" y:.1cm w:c h:c


AttrRep:
 1NOTEBOOK
 2
 3#-----------------------
 4LANG "en"
 5#-----------------------
 6CHAPTER "Description"
 7ATTR "Name"
 8ATTR "Description" lines:5
 9ATTR "Comment" lines:5
10ATTR "Referenced Competency Profile"

See also attached a screenshot from the modelling-toolkit.

Also, I would like to change following things:
  1. I would like to give the elements a default-name, which is not the same as the class name e.g. instead of Role Acute Physician-23606 I just want to name it Acute Physician-23606 (this value can be changed by the user afterwards when double-clicking. How can this be done?
  2. For a different scenario I would like that the ID of the element is not shown anymore by default in the model and that only 1 of this element can be included in the model. Thus the model is limited to 1 element of this type. How can this be done?
Thanks and best regards
Pascal
Attachment

Attachments: Draft Organizational Model.png (54.5k)

RE: Naming of modelling elements
Answer
11/29/16 9:13 AM as a reply to Pascal Sibold.
I found out, that this happens only when copying existing classes rather than creating new ones. Thus seems to be solved.

But I still would be happy to receive an answer on points 1. and 2.

Thanks a lot.

RE: Naming of modelling elements
Answer
1/18/17 8:54 AM as a reply to Pascal Sibold.
Dear Mr. Sibold,

One way to solve the problem in Question Nr. 2 would be the following:
1. You could change the ATTR in Line Number 39 of the GraphRep to "ClassName" and set the Standard Value of the Attribute "Bezeichnung" to "Rolle".
2. To solve the issue with the limitation of elements you could add the following code to the External Coupling (Library attributes.../Add-ons):
 1ON_EVENT "AfterCreateModelingNode"
 2{
 3  CC "Modeling" GET_ACT_MODEL
 4  SETL nModelId: (modelid)
 5  SETL aObjIDs: ({})
 6  CC "Core" GET_ALL_OBJS_OF_CLASSNAME modelid: (modelid) classname:"Role"
 7  #-->RESULT ecode:intValue objids:list
 8  SETL lObjIDs: (objids)
 9 
10  IF (tokcnt(lObjIDs) = 2) {
11    PROCEDURE global LIST_TO_ARRAY list:string array:array nI:integer result:reference
12    {
13      IF(token(list, nI)!="") {
14        SETL dummy: (aappend(array, VAL token(list, nI)))
15        LIST_TO_ARRAY list: (list) array: (array) nI: (nI+1) result:array
16      }
17      SETL result: (array)
18    }
19    LIST_TO_ARRAY list: (lObjIDs) array: (aObjIDs) nI: (0) result:aObjIDs
20
21    SETL nCountObj: (aObjIDs.length)
22    CC "Core" DELETE_OBJS modelid: (modelid) objids: (aObjIDs[1])
23    #-->RESULT ecode:intValue errobjs:idList
24    SET dummy: (aerase(aObjIDs, 1))
25    CC "AdoScript" ERRORBOX "Error message"    
26  }
27}

Regarding Question Nr. 1 the following solution is possible:
1. Create a new Attribute:
  Attribute name: Id
  Type: EXPRESSION
  Standard value: EXPR type:string expr:fixed: (STR objid)
2. Add the following code to the External Coupling(Library attributes.../Add-ons):
 1ON_EVENT "AfterCreateModelingNode"
 2{
 3  CC "Modeling" GET_ACT_MODEL
 4  SETL nModelId: (modelid)
 5  CC "Core" GET_ALL_OBJS_OF_CLASSNAME modelid: (modelid) classname:"Role Acute Physician"
 6  #-->RESULT ecode:intValue objids:list
 7 
 8  IF (tokcnt(objids)>0) {
 9    CC "Core" GET_ATTR_VAL objid: (VAL (token(objids,tokcnt(objids)-1))) attrname: ("Id")
10    #-->RESULT ecode:intValue val:anyValue
11    CC "Core" SET_ATTR_VAL objid: (VAL (token(objids,tokcnt(objids)-1))) attrname: ("Name") val: ("Acute Physician" + " - " + (val))
12  }
13}


Best regards,
Mateusz