Book a Demo

Author Topic: Retrieve Trigger information through C#  (Read 4897 times)

Mateus Dalepiane

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Retrieve Trigger information through C#
« on: July 24, 2013, 12:25:00 am »
Hello,

I am writing a plugin for EA and I need to retrieve information from Triggers inside a State Machine.

Looping through Elements > States > Connectors, I am able to retrieve a string with the Triggers names. But I need more information, specifically, the Trigger Type and Trigger Specification.

Looping through Elements from the State Machine I am able to find Elements with Type == Trigger, but I don't know how to retrieve the data I need from them.

I just can't find any object on the Automation Interface that can supply me this data.

Does anyone know a way to do this?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Retrieve Trigger information through C#
« Reply #1 on: July 24, 2013, 01:19:48 am »
Try
Code: [Select]
select description from t_xref where client = <trigger.object_id>That will contain something like
Quote
RefGUID={80002AF7-9144-4349-8086-43A967927029};RefName=Signal1;
RefGUID is the guid of the type element.

q.

Mateus Dalepiane

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Retrieve Trigger information through C#
« Reply #2 on: July 31, 2013, 12:08:32 am »
First of all, thanks for your reply.

Currently I am able to get the Element object that represents the Trigger.
What I am unable to do is to extract the data I need from this Element object. That would be the Trigger Type and Trigger Specification.

Anyway to get this from an Element?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Retrieve Trigger information through C#
« Reply #3 on: July 31, 2013, 01:14:32 am »
As I told above.

q.

Mateus Dalepiane

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Retrieve Trigger information through C#
« Reply #4 on: July 31, 2013, 01:31:38 am »
The code you posted seems like an SQL query, but the interface I am using doesn't look like that.
I am using Interop.EA.dll to access data within C#.

Can you explain it a little better?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Retrieve Trigger information through C#
« Reply #5 on: July 31, 2013, 04:45:38 am »
Sorry, I forgot that this is not obvious. Use Repository.SQLQuery to get a XML formatted result set. The help will have more details about this method.

q.

Mateus Dalepiane

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Retrieve Trigger information through C#
« Reply #6 on: August 01, 2013, 02:24:08 am »
Thank you very much!
I had no idea of this possibility.
Now I am able to retrieve all information I need.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Retrieve Trigger information through C#
« Reply #7 on: August 01, 2013, 03:55:38 am »
Have a look in my Inside book. It describes what is under the hood of EA.

q.