0
votes

We are opening the Customized Form in place of Properties view of EA Element on Double Click of an element in diagram or project browser i.e using EA_OnContextItemDoubleClicked Event (We are using show-dialog to open the customized form and returning false such that properties view should not open on double click). In the customized form we are trying to update the EA Element using the API element.Name and updating it. But the issue is when we update the element name it is getting reflected in project browser but if we open the EA properties view of the updated EA Element and click OK button the update will be reverted back to the old value (Old Name). Please find the code below.

public virtual bool EA_OnContextItemDoubleClicked(EA.Repository Repository,string GUID, EA.ObjectType ot)
        {
                  EA.Element ele=  Repository.GetElementByGuid(GUID);
                  ele.Name = "Test";
                  ele.Update();

 repository.AdviseElementChange(ele.ElementID);


            }
2
Which EA version? This sounds more like a bug you should report to Sparx. - qwerty_so
We are using EA Version 12.1. If we are using Update query instead of API how can we reflect the changes in project browser. For this if we use refresh model view or package update EA is crashing. - G. T.
You should post your code so we can see where your issue might be buried. Just asking "why doesn't it work" is off topic here. - qwerty_so

2 Answers

1
votes

What you are doing is playing with unsecured weapons. NEVER use Execute unless it's unavoidable (if the API lacks functionality, if performance is a must). So in your code the Execute has no reason. Set the name in to "test" before the Update and remove the Execute statement.

Besides that: t_object.ea_guid=GUID will never do anything since you will not have any result set. Or maybe it will throw an exception since GUID is no field. I guess you meant

Repository.Execute("Update t_object set t_object.Name='test' where t_object.ea_guid='" + GUID + "'");

But then again: see above!

0
votes

Using this API repository.AdviseElementChange(element.ElementID) the above problem was solved.