Book a Demo

Author Topic: problems using " EXEC_ADD_IN "  (Read 4362 times)

bachus

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
problems using " EXEC_ADD_IN "
« on: May 07, 2014, 12:22:00 am »
Hello everyone,

I struggling on this for a few days.
Using the Code template editor, I've seen that its possible to call an add-in function.

I have already made my personal add-in in C#, and it is correctly installed.

My function is just returning a string (to check if it was working...)
Code: [Select]
public string invert_string(EA.Repository ElementfromEA, String string_to_invert)
        {
            string_to_invert = "inside";
            return string_to_invert;
        }

In EA I'm calling it like this:
$tmp = %EXEC_ADD_IN("my_addin", "invert_string", "")%

Then generating the code, I got an error:  invert_string: Invalid Parameter(s)

Can you give me an hint on how to make it work ?
Or an example ?

Best regards

Tehila1

  • EA User
  • **
  • Posts: 256
  • Karma: +0/-0
    • View Profile
Re: problems using " EXEC_ADD_IN "
« Reply #1 on: May 07, 2014, 12:43:22 am »
Hello,

Two quesions please:

1. Why do you send three strings to the method?
    The method signature requires two arguments.

2. Why do you send a string as the first parameter? As far as I understand you ought to sent a repository, not a string.

Hope this help, please update.
« Last Edit: May 07, 2014, 12:56:04 am by avoda234 »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: problems using " EXEC_ADD_IN "
« Reply #2 on: May 07, 2014, 02:01:40 am »
Quote
Hello,

Two quesions please:

1. Why do you send three strings to the method?
    The method signature requires two arguments.

2. Why do you send a string as the first parameter? As far as I understand you ought to sent a repository, not a string.

Hope this help, please update.
The parameters are ok. See here: http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1395652745/1#1

So it must be something else.

I once used it, but it's too long ago.

q.

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: problems using " EXEC_ADD_IN "
« Reply #3 on: May 07, 2014, 09:42:23 am »
The problem is the method signature in your C# code.  See:
http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1367966852/1#1

Nizam Mohamed

  • EA User
  • **
  • Posts: 193
  • Karma: +1/-0
    • View Profile
Re: problems using " EXEC_ADD_IN "
« Reply #4 on: May 07, 2014, 03:18:05 pm »
Sample method, and addin call for your refernce
Code: [Select]
public string GetObjectType(EA.Repository Repository, object args)
        {
                /* Decode Arguments */
                ArrayList ary = new ArrayList((ICollection)args);
                if (ary.Count < 1)
                    return "";
                string sConnGUID = ary[0].ToString();
......
}

Addin- Call
Code: [Select]
$result = %EXEC_ADD_IN("MyAddin","GetObjectType",$GUID)%

bachus

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: problems using " EXEC_ADD_IN "
« Reply #5 on: May 08, 2014, 12:41:56 am »
Thank you !
It is now working

Best regards