get associated devices (AXL)

Version 1
    This document was generated from CDN thread

    Created by: Andreas Hoppe on 06-07-2013 09:11:39 AM
    Hallo,
    I've found the way to retrieve the associated lines for an user device profile. But I need the way back.
    I've got a line (e.g. by calling ListLineReq()) and now I need to know which devices are associated. ListLineReq returns an array of LLine. I use the uuid of each Line in LLine to call the function GetLineReq(). But this function only return the object RLine which has no property to retrieve the associated devices.
    Can anyone help?

    Subject: RE: get associated devices (AXL)
    Replied by: Thomas Ellis on 04-12-2013 10:58:58 AM
    Andreas,
    my primary usage of the AXL API is using the executeSQLQuery method but it may help you.  If you have the uuid of the line (i'm assuming that will correspond to the pkid of that line) then you could issue the uuid to the executeSQLQuery method like so:

    SELECT pkid, description, name
    FROM device
    WHERE pkid IN (
    SELECT fkdevice 
    FROM devicenumplanmap
    WHERE fknumplan = 'uuid'
    )

    Basically, the devicenumplanmap table holds all the relations of devices to lines....so, the second SELECT query will return the keys of all the devices associated with the line you're looking at.  The first SELECT query uses the results from the first query and grabs all the devices associated to that line.  This should work.  If not, let me know an example of a uuid that you are looking at.  NOTE: in the query, replace the 'uuid' with the actual uuid you are looking up, but leave the single quotes.