cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Windchill extension for thingworx: Query by id / ufid

amalecot
6-Contributor

Windchill extension for thingworx: Query by id / ufid

Hi fellow Thingworx users!

I have troubles to retrieve objects informations from windchill using the Query service, with ufid as a criteria (or even with id as a criteria, but the error is not the same).

This "Query" service is provided by the windchill extension for thingworx (i'm using version 1.6 of this extension, on a thingworx 8. Windchill is 10.2 M30 CPS07).

I wish you can kindly help me to figure out how to use it properly, or maybe show me another way to retrieve all the attributes of the object with the given ufid.

Thank you very much !

Querying a part by name or number would work fine this way :

var params = {

    containerUfid: undefined /* STRING */,

    criteria: "number = 123456" /* STRING */,

    type: "ext.thales.palma.baseline.PalmaBaseline" /* STRING */,

    dataShape: "baselineDatashape" /* DATASHAPENAME */

};

// result: INFOTABLE dataShape: "projectDatashape"

var result = me.Query(params);

But for my project, I just know the ufid of my object, and this doesn't work. The following service crash when executed with error : Unable to find logical attribute: "ufid" with context: "WCTYPE|ext.thales.palma.baseline.PalmaBaseline". but all objects are supposed to have a ufid, no ?

var params = {

        containerUfid: undefined,

        criteria: "ufid = OR:ext.thales.palma.baseline.PalmaBaseline:2450743:123456789@the-right-server-adresse.com",

        type: "ext.thales.palma.baseline.PalmaBaseline",

        dataShape: "baselineDatashape"

    };

    var result = me.Query(params);

I have tried the id criteria, but the service bellow returns me the list of all the objects of the given type, instead of only the one with the given id.

var params = {

        containerUfid: undefined,

        criteria: "id = OR:ext.thales.palma.baseline.PalmaBaseline:2450743",

        type: "ext.thales.palma.baseline.PalmaBaseline",

        dataShape: "baselineDatashape"

    };

    var result = me.Query(params);

Thanks again for your help,

Alexis

1 REPLY 1

Hi Alexis,

We should  use MBA|thePersistInfo.theObjectIdentifier.id(i.e. idA2A2 of an object) instead of ufid. This is the code snippet:

var params = {

    containerUfid: undefined /* STRING */,

    criteria: "MBA|thePersistInfo.theObjectIdentifier.id = 3137822" /* STRING */,

    type: "wt.part.WTPart" /* STRING */,

    dataShape: "ptc-part-demo-shape" /* DATASHAPENAME */

};

// result: INFOTABLE dataShape: "projectDatashape"

var result = me.Query(params);

Regards,

Tushar Bhosale

Top Tags