Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
Hi Experties.
I am trying to use some of API in Windchill extension like Create, AddContents and Query services on WindchillConnector thing but I coundn't get any related document except the simple WCTWXExtension guide which is not enough to understand it.
Especially, I am trying to use Query service with sort. u guys know any Idea?
the snippets shows me fallowing script but i don't know how to fill in the criteria section for sort.
var params = {
containerUfid: undefined /* STRING */,
criteria: navigationCriteria /* STRING */, // ex name = 'xxx*' & comment = 'xxx*'
type: "wt.doc.WTDocument" /* STRING */,
dataShape: "Document Data Shape" /* DATASHAPENAME */
};
var result = me.Query(params);
please help me or let me know any document that i could read.
Many Thanks .
Hee Park.
Hi,
I am working on these services. Give the input properties as i did and i think it'll work out fine.
----Here the 'containerUfid' is not mandatory. But if you want to narrow your search range you can provide the container ufid (eg: Site or Product containers. Note that container ufid's will have a different input format).
----'criteria' can be given as"name = 'partname'" ; "number = 'partnumber'" and so on.
----If you need to know about the input for 'type' use 'ListTypes' service to get all the types available.
----'datashape' has the field names for the output infotable (You can use 'Create Datashape' service to create datashapes for a particulat da)
Regards,
Saran
Hi Saran,
Can the criteria be a variable input such as a subfolder obid? I want to search for objects within subfolders but don't want to hard code it in the criteria (criteria:"folder.id=OR:wt.folder.SubFolder:2560185). I know I can search for objects within the container obid, but how do I also utilize a subfolder obid (folder--id) as an additional input? I want to link it with the criteria field as an input.
Kevin
Hi Kevin,
Apologies for not responding soon.
Please provide the criteria as given below and check (Replace 60694 with your subfolder id). Hope this works.
'folder.id = OR:wt.folder.SubFolder:60694'
Thanks and Regards,
Saran
Hi kevin,
I didn't understand your requirement clearly. I have added a code snippet which might help you.
var params = {
containerUfid: undefined /* STRING */,
criteria: "folder.id = OR:wt.folder.SubFolder:60694" /* STRING */,
type: "wt.part.WTPart" /* STRING */,
dataShape: 'ptc-demo.wt.part.WTPart' /* DATASHAPENAME */
};
// result: INFOTABLE dataShape: "undefined"
var IF1 = me.Query(params);
var query = {
"filters": {
"fieldName": "state--state",
"type": "EQ",
"value": "INWORK"
}
};
var params = {
t: IF1 /* INFOTABLE */,
query: query /* QUERY */
};
// result: INFOTABLE
var result = Resources["InfoTableFunctions"].Query(params);
Here the IF1 infoable gives all the parts within the subfolder. Then i filtered IF1 by the 'state--state' field. I couldn't use two inputs in the criteria. So i filtered it one by one.
Thanks and Regards
Saran
Hi Saran,
Thank you for your response. I'll try and see if that works.
To clarify, I want the user to somehow be able to select any subfolder as an input parameter within the mashup through one service. I can fill in the containerUfid from an output of a previous service as an input parameter to the current service but I also want to fill in or automatically replace the folder.id ("OR:wt.folder.SubFolder:60694") as well.
Kevin.
Hi Kevin,
I have modified the code such that the user can select between two folders (Design and manufacturing). Note that the Container ufid doen't recognize the subfolder oid. So it is used in the criteria field alone.
var Design = "OR:wt.folder.SubFolder:58891";
var Manufacturing = "OR:wt.folder.SubFolder:60694";
if(folder === "Design")
{
var params = {
containerUfid: undefined /* STRING */,
criteria: "folder.id = "+Design /* STRING */,
type: "wt.part.WTPart" /* STRING */,
dataShape: 'ptc-demo.wt.part.WTPart' /* DATASHAPENAME */
};
}
else if(folder === "Manufacturing")
{
var params = {
containerUfid: undefined /* STRING */,
criteria: "folder.id = "+Manufacturing /* STRING */,
type: "wt.part.WTPart" /* STRING */,
dataShape: 'ptc-demo.wt.part.WTPart' /* DATASHAPENAME */
};
}
// result: INFOTABLE dataShape: "undefined"
var IF1 = me.Query(params);
var query = {
"filters": {
"fieldName": "state--state",
"type": "EQ",
"value": "INWORK"
}
};
var params = {
t: IF1 /* INFOTABLE */,
query: query /* QUERY */
};
// result: INFOTABLE
var result = Resources["InfoTableFunctions"].Query(params);
Here the user gives the folder in which they want to search. Hope this works.
Regards,
saran
Hi Saran.
Thank you for your help. For my use case, the following has worked. Both the container obid and folderid are variable input parameters.