{"id":1505,"date":"2015-07-24T09:54:59","date_gmt":"2015-07-24T07:54:59","guid":{"rendered":"http:\/\/www.capri-soft.de\/blog\/?p=1505"},"modified":"2015-07-24T09:57:23","modified_gmt":"2015-07-24T07:57:23","slug":"ibm-doors-dxl-object-trigger-fires-on-object-enter-and-block-fields-prevent-fields-from-being-edited-objekt-trigger-verhindert-editieren-von-attributen-beim-doppelklick","status":"publish","type":"post","link":"https:\/\/www.capri-soft.de\/blog\/?p=1505","title":{"rendered":"IBM Doors DXL: Object Trigger fires on Object enter and block fields \/ prevent fields from being edited \/ Objekt Trigger verhindert Editieren von Attributen vor Texteingabe"},"content":{"rendered":"<h1>Problem<\/h1>\n<p>Depending on a selected value of a field, other fields should be editable \/ not be editable. <\/p>\n<p>In this case the requirements are:<\/p>\n<ul>\n<li>The object shall be editable, when no other Attribute with the description &#8222;Variant Status&#8220; has the text (or the selection in case of enum) &#8222;Proposal&#8220;<\/li>\n<li>The object shall be not ediablte, when one of Attribute with the description &#8222;Variant Status&#8220; is set to &#8222;Proposal&#8220;<\/li>\n<li>Exception: The field, that contains a set &#8222;Proposal&#8220; Value, shall be editable in each case, otherwise it would not be possible to leave that state<\/li>\n<\/ul>\n<h1>Approach &#8211; Ansatz <\/h1>\n<p>The following codes installs an Object-Trigger (not attribute), that is fired every time a user double-clicks our is entering an object, but only when the module is in edit mode;<\/p>\n<h1>Solution &#8211; L\u00f6sung <\/h1>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nstring DXLCode = &quot;\r\nTrigger    trg = current;           \r\nif (null trg) halt(); \r\nAttrDef ad  = attrdef(trg); \r\nif (null ad) halt();  \/\/ Error?\r\nObject  obj = object(trg);  \r\nif (null obj) halt();  \/\/ Error?\r\nstring  Name = ad.name;   \r\n\r\nModule mod      = module(trg);\r\nif(!isEdit(mod)) halt();\r\n\r\nObject oCurr    = current(mod);\t\r\nstring thisFieldShouldBeEditable = \\&quot;n\/a\\&quot;;\r\nbool hasProposal = false;\r\nint i=0;\r\nfor ad in mod do\r\n{\r\n  if(ad.object)\r\n  {\r\n    if(ad.description \\&quot;\\&quot; == \\&quot;Variant Status\\&quot;)\r\n    {\r\n      string BB_Variant_name=ad.name;\r\n      if(obj.BB_Variant_name \\&quot;\\&quot; == \\&quot;Proposal\\&quot;)\r\n      {\r\n        hasProposal=true;\r\n        thisFieldShouldBeEditable=BB_Variant_name;\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\nbool thisIsTheProposalField=false;\r\nif(Name==thisFieldShouldBeEditable)\r\n{\r\n\tthisIsTheProposalField=true;\r\n}\r\n\r\n\/\/ Wenn kein Attribut auf Proposal steht oder das angeklickte Feld \r\n\/\/ das Proposal Feld ist, brauchen wir nix mehr machen\r\nif(!hasProposal||thisIsTheProposalField) halt();\r\n\/\/ Wenn ein Attribut auf Proposal steht soll er blockieren\r\n\r\n\/\/ Der nachfolgende Text text verhindert dass das Edit-Event zu Ende gebracht wird\r\nset(trigPreConFail);\r\n\r\n\r\nif (isVisible(mod) and obj == oCurr)                       \r\n{\r\n   infoBox(\\&quot;The field \\&quot; thisFieldShouldBeEditable \\&quot; is set to proposal.&quot;);\r\n}\r\nelse{} \r\n&quot;      \/\/ End definition of string DXLCode\r\n \r\nTrigger trg;\r\nbool    TrigOK  = true;\r\nstring  ErrMess = checkDXL(DXLCode);\r\n \r\nif (!null ErrMess)\r\n{\r\n   print ErrMess &quot;\\n***********\\n&quot; DXLCode &quot;**********\\n&quot;\r\n   TrigOK       = false\r\n}\r\n \r\nstring  NameTrig = &quot;TriggerResetValidatedOn&quot;\r\n \r\nstring  Prompt = &quot;Delete trigger &#039;&quot; NameTrig &quot;&#039; ??&quot;\r\nif (!TrigOK) Prompt = &quot;Trigger code has errors.\\n&quot; Prompt\r\nif (confirm(Prompt))\r\n{\r\n   ErrMess = delete (NameTrig, module-&gt;object, pre, open, 6);\r\n}\r\n \r\nif (TrigOK &amp;&amp; confirm(&quot;Deploy trigger &#039;&quot; NameTrig &quot;&#039; ??&quot;))\r\n{\r\n   trg     = trigger(NameTrig, module-&gt;object, pre, open, 6, DXLCode)\r\n}\r\n<\/pre>\n<iframe src=\"http:\/\/www.facebook.com\/plugins\/like.php?href=https%3A%2F%2Fwww.capri-soft.de%2Fblog%2F%3Fp%3D1505&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" style=\"border:none; overflow:hidden; width:450px;margin-top:5px;\"><\/iframe>","protected":false},"excerpt":{"rendered":"<p>Problem Depending on a selected value of a field, other fields should be editable \/ not be editable. In this case the requirements are: The object shall be editable, when no other Attribute with the description &#8222;Variant Status&#8220; has the text (or the selection in case of enum) &#8222;Proposal&#8220; The object shall be not ediablte, &hellip; <a href=\"https:\/\/www.capri-soft.de\/blog\/?p=1505\" class=\"more-link\"><span class=\"screen-reader-text\">IBM Doors DXL: Object Trigger fires on Object enter and block fields \/ prevent fields from being edited \/ Objekt Trigger verhindert Editieren von Attributen vor Texteingabe<\/span> weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[22,19],"tags":[],"class_list":["post-1505","post","type-post","status-publish","format-standard","hentry","category-dxl","category-ibm-doors"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4yGeN-oh","jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1505","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1505"}],"version-history":[{"count":4,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1505\/revisions"}],"predecessor-version":[{"id":1508,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1505\/revisions\/1508"}],"wp:attachment":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}