Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Marcos Calleja

Pages: [1] 2
1
Hi guys!

I was working in another thing and suddenly a good idea about this problem appear in my mind. I think that maybe the problem of the query was the name of the return field.

The query was "SELECT DATABASE() FROM DUAL". So I changed for something as simple as "SELECT DATABASE() AS id FROM DUAL" and.... WORKS!!! ^^

Something really stupid yes, but the thing is that now works.

The complete code to obtain the name of the database (in mysql) where is connected the current EA project (if it's connected of course) is:
Code: [Select]
string sql = "SELECT DATABASE() AS id FROM DUAL;";
string xml = repository.SQLQuery(sql);
XmlDocument response = new XmlDocument();
response.LoadXml(xml);
XmlNodeList node = response.GetElementsByTagName("id");
string nameOfDatabase = node.Item(0).InnerText;

Anyway thanks a lot for your help. :)

2
Hi! Thanks both for response.

The ODBC connection string is the thing i'm using currently, but if the user decide to create this ODBC connection with another name, it wont work.

I'm creating an integration plugin, so I need to know the name of the database (in my company is the name of the project) to connect with the other application of my integration (Testlink btw).

My first option was launch sql queries and try to obtain it with that. Depending of the database engine you have to use different queries, and for example in mysql (the one that we are using) the query is "SELECT DATABASE() FROM DUAL".

The thing is that if I launch that query in phpmyadmin or Mysql Workbench or similar it's giving me the name, but if i launch that query using the method repository.SQLQuery("SELECT DATABASE() FROM DUAL") inside EA (in my plugin) is giving me an error.

So I was thinking maybe there's another way to obtain it, but looks like not.

Greetings and thanks for your time :)

3
Hi!

I'm trying to obtain the name of the database of the project that I'm using. In the beginning i was using the string connection to obtain it, but then I realized that actually that's the name of the ODBC connection you create to connect (it can be the name of the database or not).

Anyway I was trying to launch sql queries using repository.SQLQuery(sql) and i tried all the differents queries i saw to obtain the current name of the database in mysql. For example "SELECT Database() FROM DUAL", and work out of EA but when I launch that query inside EA it's giving me an error.

Does anyone know how to obtain it?

Greetings and thanks for your time :)

4
You are completly right. I'm kind of new doing this type of software and I actually I don't know sometimes how to do thing correctly.

Like you said, trying to store log/config files in the plugin installation folder I have errors about access permissions and I can not write (or even create) in them.

So I will do like you say.

Thanks a lot for all this help :)

5
Thanks a lot Geert, I was totally blind. Instead of trying to get it from EA I should just get it from c# like you said.

If someone finish here searching this, i'm using:

Code: [Select]
string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

6
Hi! I'm developing an addin for EA and using an installer to share it. The thing is that i want to create/save some files of config and log in the same path that the addin is installed. But because the user can change the path in the installation, i need to acquire it in execution time.

I thought that maybe there's a way to obtain it but i couldn't find anything in the SDK or in this forum.

Anyone knows if this is even possible?

Greetings and thanks for your time.  :)

7
Hi! Yes it's working, I thought the same haha but... it's connecting with a database, using a REST service and everything work.

Actually the plugin is "almost done" and i'm adding the log now. Until now i could debug directly using Visual.

Anyway thanks for everything.

8
Yes, after lose all the day trying different frameworks I was thinking about create my own logger with different levels, etc.

But when i started i thought, if it's done why are you gonna waste time doing something worst? xD.

Anyway I'm sure the configuration of log4net was right, because I tested it in another couple of simple C# projects. But when I put it to work in the EA add-in it didn't.

Did you configure or do something special to make it work with your EA add-ins?

Thanks a lot for you quickly answer.  :)

Edit: Yep, i'm logged with an administrator role so... it supposed to work. In the beginning i thought the file was in a strange location but i change the file location to be c:\log.txt and nothing.
And i tried with a lot of filters/configurations/everything.

Thanks for your help, but i think is better if i just create my own logger.

9
Hi!. I want to add a logging framework to my addin. I tried log4net and NLog but no one write in the files configurated.

I'm thinking that maybe it's happening for be encapsulated in the plugin, but i don't actually know.

So I came here to ask if someone has used one of these or another and work for him/her.

Greetings and thanks for your time.  :)

10
Automation Interface, Add-Ins and Tools / Re: How to remove elements?
« on: April 22, 2015, 11:59:36 pm »
So the only way is get the parent, iterate in the elements to find the index of the element you want to delete, and execute DeleteAt().

Thanks a lot :)

11
Automation Interface, Add-Ins and Tools / How to remove elements?
« on: April 22, 2015, 09:59:44 pm »
Hi, I tried to search in the forum but i couldn't find it.

I show a method that taking the parent of the element that you want to delete "parent.Elements.DeleteAt()" and needs the position of the element that you want to remove.

I saw also the property TreePos in the element, and i didn't try yet, but It should be something like take this treePos, get the parent, and do a parent.Elements.DeleteAt(treePos). But Im not even sure of this, so...

Is not a easier way to remove elements using the api?

Thanks a lot for your time :)

12
Automation Interface, Add-Ins and Tools / Re: Keys pressed detection
« on: April 15, 2015, 12:55:21 am »
Thanks a lot. I'm not sure if i will use this solution, but just for in case someone finish here searching the same:

http://community.sparxsystems.com/community-resources/805-triggering-add-in-functionality-with-custom-hotkeys-in-enterprise-architect

13
Automation Interface, Add-Ins and Tools / Keys pressed detection
« on: April 14, 2015, 10:10:35 pm »
Hi! Is it possible to detect a presed key with an event? I couldn't find anything about it.

Thanks :)

14
Thanks qwerty. I thought it was implemented because appear when you try to access the methods of a EA.Connector. Anyway I did as you said :)

15
Hi!. I'm trying to access a connector of a EA.Element using the method element.Connectors.GetByName(name), and if the connector doesn't exist it's ok but if exist then throws an "Action not supported" error message.

Anyone knows why is this happening?

Greetings and thanks in advance :)

Pages: [1] 2