Database, and web service integration

Discussion forum for contributors and developers who are using the QCAD version 3 ECMAScript development platform or the C++ plugin interface or who are otherwise looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Database, and web service integration

Postby magicleader » Mon Jul 16, 2012 5:44 pm

Good morning,

i have some questions about QCAD 3 features.

I would like to connect QCAD to a web application using web services (soap).

It's possible to use the scripting language to call remote web services? It's possible to connect to a dbms (mysql) and use queries?

For example i would like to retrive a list of names from a CRM software and use them as "on-demand" labels for some areas (i'm using the cad in order to project and expo area).

If possible i would like to:

    get a list of names form my crm using a web service
    display the names in a popup, the user can select a name an connect it to an element
    connect the names (using and id) to a specific object of my project (maybe an area code)

Another question..
today i tried to find a function like "search" in order to find a specific label in my project (a code for an expo area ex. D34). I can't find a "search" button in the user interface..


Thanks!

Ricardo
magicleader
Newbie Member
 
Posts: 3
Joined: Mon Jul 16, 2012 5:29 pm

Re: Database, and web service integration

Postby andrew » Mon Jul 16, 2012 7:47 pm

magicleader wrote:I would like to connect QCAD to a web application using web services (soap).

It's possible to use the scripting language to call remote web services?


Yes. There's for example the QNetworkRequest class:
http://doc.qt.nokia.com/4.7/qnetworkrequest.html

Qt also has some examples (in C++) which should also work if ported to ECMAScript:
http://doc.qt.nokia.com/4.7/examples-network.html

magicleader wrote:It's possible to connect to a dbms (mysql) and use queries?


Yes, but not out of the box. You would need to build a MySQL DB driver for Qt:
http://doc.qt.nokia.com/4.7/sql-driver.html

If the driver is compiled, you can use the classes in the QtSql module:
http://doc.qt.nokia.com/4.7/qtsql.html

magicleader wrote:For example i would like to retrive a list of names from a CRM software and use them as "on-demand" labels for some areas (i'm using the cad in order to project and expo area).

If possible i would like to:

    get a list of names form my crm using a web service
    display the names in a popup, the user can select a name an connect it to an element
    connect the names (using and id) to a specific object of my project (maybe an area code)


This sounds feasible. Probably the biggest hurdle will be building the MySQL DB driver.

magicleader wrote:today i tried to find a function like "search" in order to find a specific label in my project (a code for an expo area ex. D34). I can't find a "search" button in the user interface..


I've added a feature request for this:
http://www.ribbonsoft.com/bugtracker/in ... ask_id=644
User avatar
andrew
Site Admin
 
Posts: 2528
Joined: Fri Mar 30, 2007 6:07 am

Re: Database, and web service integration

Postby magicleader » Tue Jul 17, 2012 9:23 am

Thanks for your reply!

Qml
It's possible to use QML? I doing some research on qt web site and i noticed that it's possible to use the Xmlhttprequest...

Webkit

If i need to show a grid of data, can i use webkit in order to display the data in html format? Do you think that it's possible to bind a click over an html element (for example a link) to a QCAD function?

Getting project elements

In Qcad it's possible to identify an element using an ID?

I would like to store in a DB (maybe using webservices so i will not need db drivers) infos like ["CustomerID, "QCADElementID", "Status"].
When i click over the element identified by QCADElementID i would like to show the Customer info (using webkit calling a specific URL). The element could be a string (a stand name ex A1, D45, D46)..

In my previus post i asked about the search function because i wanted to parse the dwg project and color the strings matching my DB entries ... I was thinking to bind my customer record to a strings (a stand/area code).
magicleader
Newbie Member
 
Posts: 3
Joined: Mon Jul 16, 2012 5:29 pm

Re: Database, and web service integration

Postby andrew » Tue Jul 17, 2012 10:12 am

magicleader wrote:Qml
It's possible to use QML? I doing some research on qt web site and i noticed that it's possible to use the Xmlhttprequest...


QML is not interesting for us at this point (QML targets touch devices such as tablets).
It might be possible to use QML - I simply never looked into that.

magicleader wrote:Webkit
If i need to show a grid of data, can i use webkit in order to display the data in html format?


Yes, we also use web kit for the tag view of the part library browser.

magicleader wrote:Do you think that it's possible to bind a click over an html element (for example a link) to a QCAD function?


Yes, we also do that in the library browser. You can register a function to be called when the user clicks a link.

magicleader wrote:Getting project elements
In Qcad it's possible to identify an element using an ID?


Yes. Object IDs are valid for the lifetime of the document, object handles are persistent and are stored in DXF / DWG.

magicleader wrote:I would like to store in a DB (maybe using webservices so i will not need db drivers) infos like ["CustomerID, "QCADElementID", "Status"].
When i click over the element identified by QCADElementID i would like to show the Customer info (using webkit calling a specific URL). The element could be a string (a stand name ex A1, D45, D46)..


This certainly sounds possible.

magicleader wrote:In my previus post i asked about the search function because i wanted to parse the dwg project and color the strings matching my DB entries ... I was thinking to bind my customer record to a strings (a stand/area code).


Programmatically, you can search for a text with a code snippet like this:
Code: Select all
    var di = this.getDocumentInterface();
    var document = this.getDocument();

    var ids = document.queryAllEntities();

    for (var i=0; i<ids.length; i++) {
        var entityId = ids[i];
        var entity = document.queryEntity(entityId);
        if (!isTextEntity(entity)) {
            continue;
        }

        var text = entity.getEscapedText();

        // do something with the text
        // e.g. compare, etc...
    }
User avatar
andrew
Site Admin
 
Posts: 2528
Joined: Fri Mar 30, 2007 6:07 am


Return to QCAD 3 Developers and Contributors

Who is online

Users browsing this forum: No registered users and 0 guests