AAU ProjectProject specific questions and answers from the project at Alpen-Adria Unversity Klagenfurt.Model-based conditions in design (icon) viewVladimir Shekhovtsovhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=20526932021-02-09T22:31:05Z2021-02-09T22:31:05ZHello,<br /><br />I would like to show different icons on a modeling palette depending on the availability of some class instances in a model. The example could look as follows:<br />1) The class A contains an INTERREF pointing to an instance of the class B. The functionality of A is reduced without B, and usually the instance of B should exist somewhere on a diagram before A. <br />Still instances of A can be created without B, but their icons are shown in grayscale on the diagram to indicate the reduced functionality.<br />2) When there are no instances of class B available in a model, I would like to make the icon of class A on a modeling palette also shown in grayscale. <br />3) So I need to know the number of instances for the certain class when I show the icon on a modeling palette, I can set e.g. this diagram's <strong>__ModelTypeMetaData__</strong> property values to these numbers, <br />but I have no idea if I can refer to these properties in the design mode. Is it possible at all?Vladimir Shekhovtsov2021-02-09T22:31:05ZRE: ADOxx-graphical user interfaceMartin Paczonahttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=19130042020-07-10T08:39:39Z2020-07-10T08:37:04ZHello Wilfrid,<br /><br /><strong>Is it possible to rotate the loaded image or do i need to load different pictures to implement a rotation function ?</strong><br /><br />Currently i have implemented the "rotation function following":<br />...<br />IF (rot="0°")<br />{<br />SET filename<img alt="emoticon" src="https://www.adoxx.org/livehttps://www.adoxx.org/ADOxxORGv3-theme/images/emoticons/sad.gif" >"db:\\resistor.png")<br />}<br />ELSIF (rot="90°")<br />{<br />SET filename<img alt="emoticon" src="https://www.adoxx.org/livehttps://www.adoxx.org/ADOxxORGv3-theme/images/emoticons/sad.gif" >"db:\\resistor90.png")<br />}<br />...<br /><br />BR<br />MartinMartin Paczona2020-07-10T08:37:04ZRE: Change the start/end position of the connectionsMateusz Dziedzichttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=16474962019-08-14T06:38:10Z2019-07-19T11:18:20ZA functionality, which can be useful for that purpose is the modelling assistant. This way a connection to another object is done from a pre-set connection point on the side you select. To activate the modelling assistant click on the icon in the modelling toolkit. The functionality interprets the meta model and provides the selection capabilities. The assistant enables the creation of objects on every side of the source.Mateusz Dziedzic2019-07-19T11:18:20ZRE: Change the start/end position of the connectionsMartin Paczonahttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=16074482019-06-15T11:40:06Z2019-06-15T11:37:56Z<div class="quote"><div class="quote-content">Hello,<br /><br />Any news on pre-setting the connection points for the modeling elements ? <br /><br />Best Regards,<br />Martin Paczona</div></div>Martin Paczona2019-06-15T11:37:56ZRE: Restrict number of contained elements in GroupWilfrid Utzhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=9248372017-06-26T11:33:27Z2017-06-26T11:33:27ZHi,<br /><br />yes, ADOxx allows you to define such restrictions using Class Cardinalities that can be defined for each class using the "Class cardinality" attribute. <br /><br /><strong>Background: Container/Aggregation Classes</strong><br />For container elements this is also possible, as any class derived from __D_aggregation__ has an in an invisible relation class associated and is created between the container (=Group) and any instance of class put inside. This relation is called "Is inside" and you can also use a) queries to find the relation as there is not visualization (e.g. AQL Statement: <div class="code"><span class="code-lines">1</span>({"INSTANCE_NAME":"Group"}<-"Is inside") OR ({"INSTANCE_NAME":"Group"}->"Is inside"))</div>or <br />move the group with all contained elements by holding down the SHIFT key when selecting the group and moving it) THis helps you to check whether the relation is available.<br /><br /><strong>Class Cardinalities</strong><br />To restrict the maximum number of conainted objects, you have to define a cardinality rule like below:<div class="code"><span class="code-lines">1</span>RELATION "Is inside"<br /><span class="code-lines">2</span>max-incoming:5<br /><span class="code-lines">3</span>max-outgoing:5<br /></div><br />This rule needs to be defined in the container class, class attribute "Class cardinalities". An example using the BPMN library from here is shown in the screenshot attached (Restricting the containment to 5 elements for a Group instance).<br />Further details on the syntax of the class cardinalities are available here: <a href="https://www.adoxx.org/live/class-cardinalities">https://www.adoxx.org/live/class-cardinalities</a> and also in the FAQ section in multiple <a href="https://www.adoxx.org/live/faq/-/message_boards/search?_19_formDate=1498475702814&_19_redirect=https%3A%2F%2Fwww.adoxx.org%2Flive%2Ffaq%3Fp_p_id%3D19%26p_p_lifecycle%3D0%26p_p_state%3Dnormal%26p_p_mode%3Dview%26p_p_col_id%3Dcolumn-1%26p_p_col_count%3D1&_19_breadcrumbsCategoryId=0&_19_searchCategoryId=0&_19_keywords=cardinalities">threads</a>.<br /><br /><strong>Cardinalities Check Trigger</strong><br />The trigger for a rule check can be configured. By default it is manual, meaning the modeller needs to a) have a model open and b) clicks on "Model" -> "Check cardinalities" (see screenshot attached). In case you want to trigger it during the modelling, you can update this as a configuration the in the library attribute "Default configuration" of the dynamic library in chapter "Modelling".<br /><br /><div class="code"><span class="code-lines">1</span>CHECK_CARDINALITIES before-save: boolVal after-modeling-action: boolVal </div>where boolVal is 0 or 1. An example configuration for an "before-save" check is shown in the attached screenshot.<br />The effect is that each modelling step and/or when a model is saved the check is run.Wilfrid Utz2017-06-26T11:33:27ZRestrict number of contained elements in Grouphttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=9248262017-06-26T11:23:14Z2017-06-26T11:23:04ZI would like to restrict a specific class that acts as a container to a certain number of instances contained (for example only 5 instances). Is this possible in ADOxx.2017-06-26T11:23:04ZRE: ADOxx database connectionPatrikhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=8575112017-05-18T10:42:34Z2017-05-18T10:42:08ZIt seems to have solved our problem. Thank you for the instructions and the help.Patrik2017-05-18T10:42:08ZRE: ADOxx database connectionMateusz Dziedzichttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=8524862017-05-12T09:52:29Z2017-05-12T09:51:44ZDear Patrik,<br /> <br />Thank you for your message. This problem relates to the way the ODBC connection is establishing the connection to the SQL Server. By default, the connection is established using TCP-IP protocol, meaning that a network adaptor is required to have it running (even if not connected).<br /><br />In case the network connection is interrupted (e.g. standby-mode, hibernate, or Microsoft Windows Energy Management turning the adaptor off), ADOxx looses the connection to the database, and an error message is shown (adbsess-02).<br /> <br />To prevent such a behaviour, you can switch the protocol to non-network (e.g. Shared Memory). This can be achieved in the SQL Configuration Manager (installed as part of the SQL server) - see screenshot attached.<br />Change the protocol by activating one, and de-activating the other and then restart the SQL Service or your PC to be safe.<br /> <br />You can test if this step is operational by following the steps below:<br /> <br />a) Start ADOxx and login (also applicable to any tool developed using ADOxx)<br />b) Set the computer on STANDBY, or HIBERNATE respectively<br />c) Reactivate the computer: using Shared Memory the tool continues to run, with TCP-IP the connection is aborted and the error occurs.Mateusz Dziedzic2017-05-12T09:51:44ZRE: ADOxx database connectionPatrikhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=8516782017-05-11T15:04:57Z2017-05-11T15:04:39ZHi,<br /><br />we have a similar problem, where the connection to the database seems to be interrupted after a few minutes of inactivity (before the screen lock kicks in). We get an error "[adbsess-02] Due to a database exception the connection has been closed. No further databae access will be conducted in the current session. It is recommended to restart the application." The database (MS-SQL 2012) is installed locally on the same computer as the tool. How can we solve the problem?<br /><br />Best regards,<br />PatrikPatrik2017-05-11T15:04:39ZRE: write in classeMehmet Albayrakhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=4078262015-11-16T12:41:07Z2015-11-16T12:41:07ZTo fill instances with information in the modeling environment, one has to define attributes for the class of these instances. Which is documented at the followinng thread:<br /><a href="https://www.adoxx.org/live/faq/-/message_boards/message/407743">https://www.adoxx.org/live/faq/-/message_boards/message/407743</a>Mehmet Albayrak2015-11-16T12:41:07Zwrite in classeMeggan Taussachttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=4069892015-11-14T11:45:38Z2015-11-14T11:45:20ZHello,<br /><br />I want to know how the user can write into the class in the modeling toolkit.<br /><br />I want click in the class and it proposes that we write to them.<br /><br />Can somebody help me please ?<br /><br />(ps : sorry for my english, I hope you understand)Meggan Taussac2015-11-14T11:45:20ZRE: Object class-dependent context menuWilfrid Utzhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=3726312015-09-23T13:03:52Z2015-09-23T13:01:00ZWhen defining context menus, it is not possible to define a context entry specifically for one class or relation but only for abstract tool "types. The AdoScript code to add a context entry and support context definitions are listed below:<br /><br /><div class="code"><span class="code-lines">1</span>CC "Application" INSERT_CONTEXT_MENU_ITEM context:Context item:strValue [ pos:strValue ]</div><br />where context can be one of the following:<br />"drawingarea.general" -- General drawing area context menu.<br />"drawingarea.swimlane" -- Drawing area context menu for swimlanes.<br />"drawingarea.mobject" -- Drawing area context menu for modeling objects.<br />"drawingarea.connector" -- Drawing area context menu for connectors.<br />"modelingtable" -- "Tabular modeling" browser context menu.<br />"explorer.db" -- Explorer context menu in "models in database" mode.<br />"explorer.windows" -- Explorer context menu in "opened model windows" mode.<br />"startpage.thumb" -- Start page context menu for a model thumbnail.<br /><br />The menu name is specified with item. If the item shall be placed in a submenu, the parts of the item path are separated by TAB ("\t") characters, e.g. "New\tModelgroup...". A separator can be inserted by using "-" as item name.<br /><br />To accomplish the behaviour to distinguish between types, you can implement a mechanim retrieve all selected elements, iterate through them and distinguish between specific classes.<br /><br />An example for such an implementation is shown in the code fragement below, applicable for the "drawingarea.mobject" context.<br /><br /><strong>A. Add the context in "External coupling" library attribute</strong><div class="code"><span class="code-lines">1</span>ON_EVENT "AppInitialized" {<br /><span class="code-lines">2</span> # ...<br /><span class="code-lines">3</span> CC "Application" INSERT_CONTEXT_MENU_ITEM context:"drawingarea.mobject" item:"Context on object"<br /><span class="code-lines">4</span> CC "Application" raw SET_CMI_SELECT_HDL context:"drawingarea.mobject" item:"Context on object" {<br /><span class="code-lines">5</span> EXECUTE file: ("db:\\objectcontext.asc")<br /><span class="code-lines">6</span> }<br /><span class="code-lines">7</span> # ...<br /><span class="code-lines">8</span>}<br /></div><br /><strong>B. Code in "objectcontext.asc"</strong><br /><br /><div class="code"><span class="code-lines"> 1</span># 1. Get all objects selected when triggering the context action<br /><span class="code-lines"> 2</span>CC "Modeling" GET_SELECTED<br /><span class="code-lines"> 3</span>SET lSelectedObjects: (objids)<br /><span class="code-lines"> 4</span># 2. Retrieve class information, and perform action for each class type<br /><span class="code-lines"> 5</span>FOR sObjectID in: (lSelectedObjects) {<br /><span class="code-lines"> 6</span> CC "Core" GET_CLASS_ID objid: ( VAL sObjectID)<br /><span class="code-lines"> 7</span> SET bIsRelation: (isrel)<br /><span class="code-lines"> 8</span> SET nClassID: (classid)<br /><span class="code-lines"> 9</span> IF (bIsRelation) {<br /><span class="code-lines">10</span> # no action performed, as the context is only for classes<br /><span class="code-lines">11</span> }<br /><span class="code-lines">12</span> ELSE {<br /><span class="code-lines">13</span> # get class name<br /><span class="code-lines">14</span> CC "Core" GET_CLASS_NAME classid: (nClassID)<br /><span class="code-lines">15</span> SET sClassName: (classname)<br /><span class="code-lines">16</span> IF (sClassName = "Car") {<br /><span class="code-lines">17</span> CC "AdoScript" INFOBOX ("Found a car with ID: " + sObjectID + "\n\nPerform a specific car action now!")<br /><span class="code-lines">18</span> }<br /><span class="code-lines">19</span> ELSIF (sClassName = "Truck") {<br /><span class="code-lines">20</span> CC "AdoScript" INFOBOX ("Found a truck with ID: " + sObjectID + "\n\nPerform a specific truck action now!") <br /><span class="code-lines">21</span> }<br /><span class="code-lines">22</span> ELSE {<br /><span class="code-lines">23</span> #catch all case<br /><span class="code-lines">24</span> CC "AdoScript" INFOBOX ("No action found for class: " + sClassName + "!\n\nSeems the developer has not though about that case")<br /><span class="code-lines">25</span> }<br /><span class="code-lines">26</span> }<br /><span class="code-lines">27</span>}<br /></div><br />A similar approach can be used for relationclasses. An example implementation can be found in the attached library and AdoScript files.Wilfrid Utz2015-09-23T13:01:00ZObject class-dependent context menuVladimir Shekhovtsovhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=3726202015-09-23T12:45:59Z2015-09-23T12:45:59ZI am trying to implement the context menu that is going to be shown only for the objects of the particular class, but, according to the documentation, this seems to be not possible:<br />"You cannot constrain the new context menu to a specific class or relationship type. So it is wise to give the menu entry a general name and then adjust the functionality, <br />according to the selected object, within the body of the function. "<br /><br />I have tried to investigate if the workaround like the one used for model-type-specific menus could be used in this case, but, again, this seems to be not <br />possible as well because I was not able to find the event fired on activation of the particular object on a diagram.<br /><br />This is quite an unfortunate restriction for me as I have currently implemented a deployment configuration for my system as a diagram object and wanted to make a context menu for<br />the particular configuration run a script performing the actual deployment. Unfortunately, there are other objects on this diagram which must not support this context menu.<br /><br />Am I missing anything? Are there any workarounds for this "context menu" approach?Vladimir Shekhovtsov2015-09-23T12:45:59ZRE: How to prevent adding a new graphical element to the current modelSabin Popescuhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=3581912015-08-18T12:38:26Z2015-08-18T12:37:09ZHi, Fadi.<br /><br />As described in the <a href="https://www.adoxx.org/AdoScriptDoc/files/Events/Modeling/AfterCreateModelingNode-js.html">ADOxx Documentation</a>, the event "AfterCreateModelingNode" has no exit value. <br /><br />I would suggest trying the DELETE_OBJS command call, as described <a href="https://www.adoxx.org/AdoScriptDoc/files/Message_Ports/Manipulation_APIs/Core/DELETE_OBJS-js.html#DELETE_OBJS">here</a>. Just add it right after the command call ERRORBOX or instead of the command EXIT (nExitValue1).<br /><br />Hope it helps.<br />SabinSabin Popescu2015-08-18T12:37:09ZHow to prevent adding a new graphical element to the current modelFadi Al Machothttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=3581732015-08-18T12:27:02Z2015-08-18T12:27:02ZI am trying to prevent adding a new element of class "Behavioral Unit" to the current model after having a specific number of Behavioral Units, I am using <br />ON_EVENT "AfterCreateModelingNode" it works well and shows the error message, my problem that although I am exiting the event using the variable "nExitValue1", the new added element is created, what it should not happen. <br /><br />My script is:<br /><br />SET nExitValue1:0<br />CC "Modeling" GET_ACT_MODEL<br />SET idCrtModelID: ( modelid )<br />CC "Core" GET_MODEL_INFO modelid: (idCrtModelID) <br /><br /><br /> IF (modeltype="Task Context") <br /> {<br /> <br />SET aqlGetPredecessorsForObj: ("(<\"Behavioral Unit\">)")<br /> CC "AQL" EVAL_AQL_EXPRESSION expr: (aqlGetPredecessorsForObj) modelid: (idCrtModelID) <br /> SETL bUNodeIDs: (objids)<br /> SET i:0<br /> FOR bIDs in: (bUNodeIDs) {<br /> SET i: (i+1)<br /> <br /> }<br /> #CC "AdoScript" INFOBOX ("num " + STR i)<br /> IF (i > 1)<br /> {<br /> CC "AdoScript" ERRORBOX ("Adding a new Behavioral Unit is not allowed")<br /> SET nExitValue1: (-1)<br /> <br /> }<br /> }<br /><br /><br />and in External Coupling I have:<br /><br />ON_EVENT "AfterCreateModelingNode" {<br />EXECUTE file: ("Z:\\AfterCreateModelingNode.asc") scope:same<br />EXIT (nExitValue1)<br />}Fadi Al Machot2015-08-18T12:27:02ZRE: How to get the ID of the deleted Reference modelsMehmet Albayrakhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=3578782015-08-17T13:17:11Z2015-08-17T12:58:09ZDear Fadi,<br />Thank you for your question. To realize your scenario you have to compare two lists of target object ids: <br /><br />1) The target object id list before deleting<br />2) The target object id list after deleting<br /><br />In order to receive these list of ids you have to parse the old and the new attribute value of "Participating". Please find below the example that delivers you the target object id of the deleted interref. Which you can also find in the attached AdoScript file.<br /><br /><br /><div class="code"><span class="code-lines"> 1</span>ON_EVENT "SetAttributeValue" {<br /><span class="code-lines"> 2</span><br /><span class="code-lines"> 3</span>SETG nCurrentObjID: (instid)<br /><span class="code-lines"> 4</span>SETG oOldValue: (oldval)<br /><span class="code-lines"> 5</span>SETG nCurrentModelID: (modelid)<br /><span class="code-lines"> 6</span>SETG nCurrentAttrID: (attrid)<br /><span class="code-lines"> 7</span><br /><span class="code-lines"> 8</span>CC "Core" GET_CLASS_ID objid: (nCurrentObjID)<br /><span class="code-lines"> 9</span>SET nCurrentClassID: (classid) <br /><span class="code-lines">10</span>CC "Core" GET_ATTR_ID classid: (nCurrentClassID) attrname: "Participating"<br /><span class="code-lines">11</span>SET nParticipatingAttrID: (attrid)<br /><span class="code-lines">12</span># only continue if the correct ID<br /><span class="code-lines">13</span>IF (nCurrentAttrID = nParticipatingAttrID) { <br /><span class="code-lines">14</span> CC "Core" GET_ATTR_VAL objid: (nCurrentObjID) attrname: ("Participating") <br /><span class="code-lines">15</span> SET oNewValue: (val) <br /><span class="code-lines">16</span> IF (LEN oOldValue > LEN oNewValue) { <br /><span class="code-lines">17</span><br /><span class="code-lines">18</span> ##########################################<br /><span class="code-lines">19</span> # Get target Ids of the deleted InterRefs#<br /><span class="code-lines">20</span> ##########################################<br /><span class="code-lines">21</span><br /><span class="code-lines">22</span> # Get list of the InterRefs of the NEW Attribute Value with parsing the InterRefs after calling all outgoing InterRefs<br /><span class="code-lines">23</span> CC "Core" GET_ALL_INTERREFS_OF_ATTR objid: (id_InstId) attrid: (nCurrentAttrID)<br /><span class="code-lines">24</span> SET s_IntReftext: (reftext)<br /><span class="code-lines">25</span> SET listIds:""<br /><span class="code-lines">26</span> FOR i in: (s_IntReftext) sep:"\n" {<br /><span class="code-lines">27</span> SET parseExp: (i)<br /><span class="code-lines">28</span> IF (parseExp!="") {<br /><span class="code-lines">29</span> # Search for target object id with parsing a LEO expression<br /><span class="code-lines">30</span> LEO parse: (parseExp) get-str-value:str_ToObjId:"tobjid"<br /><span class="code-lines">31</span> # If you want to obtain target modelid than enter "tmodelid" instead of "tobjid"<br /><span class="code-lines">32</span> # Save in a list<br /><span class="code-lines">33</span> SET listIds: (tokunion(listIds,str_ToObjId))<br /><span class="code-lines">34</span> }<br /><span class="code-lines">35</span> }<br /><span class="code-lines">36</span><br /><span class="code-lines">37</span> # Get list of the InterRefs of the OLD Attribute Value with parsing the attribute value<br /><span class="code-lines">38</span> SET olistIds:""<br /><span class="code-lines">39</span> FOR j in: (oOldValue) sep:"\n" {<br /><span class="code-lines">40</span> SET oparseExp: (j)<br /><span class="code-lines">41</span> IF (oparseExp !="") {<br /><span class="code-lines">42</span><br /><span class="code-lines">43</span> #Obtain the several values of the Interref by LEO parse<br /><span class="code-lines">44</span> LEO parse: (oparseExp) get-str-value:str_oToObjName:"i"<br /><span class="code-lines">45</span> LEO parse: (oparseExp) get-str-value:str_oToModelType:"mt"<br /><span class="code-lines">46</span> LEO parse: (oparseExp) get-str-value:str_oToModel:"m"<br /><span class="code-lines">47</span> LEO parse: (oparseExp) get-str-value:str_oToClassId:"c"}<br /><span class="code-lines">48</span><br /><span class="code-lines">49</span> #Get target object ids and save them in a list<br /><span class="code-lines">50</span> CC "Core" GET_MODEL_ID modelname: (str_oToModel) modeltype: (str_oToModelType)<br /><span class="code-lines">51</span> SET nReferencedModelId: (modelid)<br /><span class="code-lines">52</span> CC "Core" GET_CLASS_ID classname: (str_oToClassId)<br /><span class="code-lines">53</span> SET nReferencedClassId: (classid)<br /><span class="code-lines">54</span> CC "Core" GET_OBJ_ID modelid: (nReferencedModelId) classid: (nReferencedClassId) objname: (str_oToObjName)<br /><span class="code-lines">55</span> SET noToObjId: (objid)<br /><span class="code-lines">56</span> SET olistIds: (tokunion(olistIds,STR noToObjId))<br /><span class="code-lines">57</span> }<br /><span class="code-lines">58</span><br /><span class="code-lines">59</span> # Compare and make the difference between the old and the new value<br /><span class="code-lines">60</span> SET l_DeletedTargetIdsOfInterRefs: (tokdiff(olistIds,listIds))<br /><span class="code-lines">61</span> CC "AdoScript" INFOBOX (l_DeletedTargetIdsOfInterRefs)<br /><span class="code-lines">62</span> }<br /><span class="code-lines">63</span>}<br /><span class="code-lines">64</span>}<br /></div><br />As the InterRef "Participating" is an object reference the example delivers the deleted objids and not the modelids. But the principle of the implementation would be the same.<br /><br />.Mehmet Albayrak2015-08-17T12:58:09ZHow to get the ID of the deleted Reference modelsFadi Al Machothttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=3575422015-08-17T08:33:33Z2015-08-17T08:29:02ZIf we have an attribute of datatype "Interref " called "Participating", how can we get the Ids of the selected reference models when we have a set of them, e.g., <br />The current script for the event <em><strong>SetAttributeValue</strong></em><strong><em> </em></strong> idetifies if the user did delete a model or did add a new model, then I would like to get the Id of the deleted ones:<br /> <br /> <br />SET nCurrentObjID: (instid)<br />SET oOldValue: (oldval)<br />SET nCurrentModelID: (modelid)<br />SET nCurrentAttrID: (attrid)<br />CC "Core" GET_CLASS_ID objid: (nCurrentObjID)<br />SET nCurrentClassID: (classid)<br /> <br />CC "Core" GET_ATTR_ID classid: (nCurrentClassID) attrname: "Participating"<br />SET nParticipatingAttrID: (attrid)<br /># only continue if the correct ID<br />IF (nCurrentAttrID = nParticipatingAttrID) {<br /> CC "Core" GET_ATTR_VAL objid: (nCurrentObjID) attrname: ("Participating")<br /> SET oNewValue: (val)<br /> IF (LEN oOldValue > LEN oNewValue) {<br /> # this is a removal<br /><u><em><strong># Get Ids of the deleted ones</strong></em></u><br /> }<br />}<br />}Fadi Al Machot2015-08-17T08:29:02ZRE: Adding reference models autonomously (two sided)Fadi Al Machothttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=3558162015-08-10T09:16:47Z2015-08-10T09:10:44ZThank you Wilfrid,<br />what is the event to know if the user did click the "+" to add a reference model, or if he did click "*" to delete a reference model?<br />Currently, I am using the event "AfterEditAttributeValue" which works for both without knowing what is the clicked choice.Fadi Al Machot2015-08-10T09:10:44ZRE: Adding reference models autonomously (two sided)Wilfrid Utzhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=3552072015-08-06T09:30:22Z2015-08-06T09:30:22ZTo create such an reference as an inverse of the actual one created can be achieved using events and AdoScript. Please be aware that the system is already aware of the backlink itself, not explicitly as an attribute but within script and querying functionalities of ADOxx. To give you examples how to see this examples, please consider the following approaches already provided by the platform.<br /><br /><strong>+ UI - see pointing-at relations through the Object reference context menu entry:</strong> For any objects you can right-clcik and select the "Object reference" entry. This will return a clickable list of all other instances referencing the object. These objects can also be moved to others (all, single one) or used as a report<br /><strong><br />+ AQL: </strong>it is possible to query all pointers using AQL using "<--". An example would look like <br /><br /><div class="code"><span class="code-lines">1</span>{"Document-4711"} <--</div><br />This would return all pointing instance IDs to the object named "Document-4711".<br /><br /><strong>+ AdoScript: </strong>you can execute the AQL of above using AdoScript using the<br /><br /><div class="code"><span class="code-lines">1</span>CC "AQL" EVAL_AQL_EXPRESSION expr:strValue ( modelid:intValue | modelscope )<br /><span class="code-lines">2</span>#RESULT ecode:intValue objids:strValue<br /></div><br />or use the direct command <div class="code"><span class="code-lines">1</span><br /><span class="code-lines">2</span>CC "Core" GET_INCOMING_INTERREFS Target [ sourcemodelids:strValue ] .<br /><span class="code-lines">3</span>Target : objid:intValue | modelid:intValue .<br /><span class="code-lines">4</span># RESULT ecode:intValue reftext:references<br /></div><br /><strong>Automatically create INTERREFs based on INTERREFs<br /></strong>Using events, you can also perform the behaviour to create a (redundant) INTERREF. Please be aware that this script needs heavy testing and validation as there are assumption with respect to the metamodel and availability of attributes, but it should give you a hint how things are done. In addition, redundancies are not checked and corrected. Please let us know if you need further details here.<br /><br /><div class="code"><span class="code-lines"> 1</span>ON_EVENT "AfterEditAttributeValue" {<br /><span class="code-lines"> 2</span> # instid : integer ID of the changed instance.<br /><span class="code-lines"> 3</span> # attrid : integer Attribute ID.<br /><span class="code-lines"> 4</span> # modelid : integer ID of the model containing the changed instance.<br /><span class="code-lines"> 5</span> SET nCurrentObjID: (objid)<br /><span class="code-lines"> 6</span> SET nCurrentModelID: (modelid)<br /><span class="code-lines"> 7</span> SET nCurrentAttrID: (attrid)<br /><span class="code-lines"> 8</span> CC "Core" GET_CLASS_ID objid: (nCurrentObjID)<br /><span class="code-lines"> 9</span> SET nCurrentClassID: (classid)<br /><span class="code-lines">10</span> CC "Core" GET_ATTR_ID classid: (nCurrentClassID) attrname: "Participating"<br /><span class="code-lines">11</span> SET nParticipatingAttrID: (attrid)<br /><span class="code-lines">12</span> # only continue if the correct ID<br /><span class="code-lines">13</span> IF (nCurrentAttrID = nParticipatingAttrID) {<br /><span class="code-lines">14</span> # get the created INTERREF count<br /><span class="code-lines">15</span> CC "Core" GET_INTERREF_COUNT objid: (nCurrentObjID) attrid:(nParticipatingAttrID)<br /><span class="code-lines">16</span> # get value of latest<br /><span class="code-lines">17</span> CC "Core" GET_INTERREF objid: (nCurrentObjID) attrname:"Participating" index: (count)<br /><span class="code-lines">18</span> SET nTargetObjectID: (tobjid)<br /><span class="code-lines">19</span> SET nTargtClassID: (tclassid)<br /><span class="code-lines">20</span> # TODO: Potentially LOAD model to be able to modify<br /><span class="code-lines">21</span> # get the attribute ID of the target class attribute, assumption the INTERREF DOMAIN is correct<br /><span class="code-lines">22</span> CC "Core" GET_ATTR_ID classid: (nTargetClassID) attrname:"Participating"<br /><span class="code-lines">23</span> SET nTargetParticipatingID: (attrid)<br /><span class="code-lines">24</span> CC "Core" ADD_INTERREF objid: (nTargetObjectID) attrid: (nTargetParticipatingID) tobjid: (nCurrentObjID)<br /><span class="code-lines">25</span> }<br /><span class="code-lines">26</span>}<br /></div>Wilfrid Utz2015-08-06T09:30:22ZRE: Strings and arrays using GRAPHREPWilfrid Utzhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=3551992015-08-06T08:51:15Z2015-08-06T08:51:15ZThe proposal would be to use (LEO) Expression within the GRAPHREP and represent the result of these expressions. A brief example can be seen below, applying the String token functions (see the definition <a href="http://www.adoxx.org/live/expressions">here</a>) and control logic in GRAPHREP<br /><br />Assuming the STRING in t1 looks somewhat like this:<br />"A <strong>AND </strong>B <strong>OR </strong>C <strong>AND </strong>D <strong>XOR </strong>F <strong>OR </strong>G <strong>AND </strong>K..."<br /><br />you can write the following within the GRAPHREP to retrieve the number of ANDs<br /><br /><div class="code"><span class="code-lines">1</span>SET t1:"A AND B OR C AND D XOR F OR G AND K"<br /><span class="code-lines">2</span>SET andCount:0<br /><span class="code-lines">3</span>FOR word in: (t1) {<br /><span class="code-lines">4</span> IF (word = "AND") {<br /><span class="code-lines">5</span> SET andCount: (andCount+1)<br /><span class="code-lines">6</span> }<br /><span class="code-lines">7</span>}<br /><span class="code-lines">8</span>TEXT (STR andCount) x:-1.5cm y:0.01cm w:c h:c<br /></div><br />A similar logic can be applied for OR, XORs by extending the IF condition within the loop and adding to the counter.Wilfrid Utz2015-08-06T08:51:15Z