windchill info*engine tasks
Hi,
I'm currently trying out 'Using Custom Reports from Windchill' example given in the PTC Windchill Extension Guide. I have created the required datashapes for 'wt.inf.container.WTContainer' and 'wt.query.template.ReportTemplate'. While implementing the service code I checked if the three parts are returning the infotable.
The first part of the code returned the infotable with Drive system. But the second part only provides a blank infotable(i.e. only the fields of the datashape is returned). There was no 'Part Assembly' report template. Should i create it or is it a part of the extension?? . But i ignored that and completed the service. I gave the partName,version,partRevision as inputs. The output error i got is:
Error executing service
Wrapped java.lang.Exception: Unable to process I*E query: Invalid datashape [AssemblyReport] Cause: Unable to process I*E query: Invalid datashape [AssemblyReport]
My service is:
//Query for the context in which the report template lives. For example, this code queries for the “Drive System” context:
// containers reportTemplates
var containers = Things["ptc-windchill-demo-thing"].Query({
criteria:"name = 'Drive System'",
dataShape: 'test.wt.inf.container.WTContainer',
type: 'WCTYPE|wt.inf.container.WTContainer'
});
if(containers.getRowCount() > 0) {
var containerUfid = containers.getRow(0).ufid;
logger.debug("Using container UFID " + containerUfid);
}
//Query for the report template by name and its context. For example, this code queries for the report template named “Part Assembly”
var reportTemplates = Things["ptc-windchill-demo-thing"].Query({
criteria: "name = 'Part Assembly'",
dataShape: 'test.wt.query.template.ReportTemplate',
type: 'WCTYPE|wt.query.template.ReportTemplate',
containerUfid: containerUfid
});
if(reportTemplates.getRowCount() > 0) {
var reportTemplateUfid = reportTemplates.getRow(0).ufid;
logger.debug('Using report template UFID ' + reportTemplateUfid);
}
//Invoke the Info*Engine ExecuteReportTemplate task. In this example, the report requires parameters “name” and “version,” so those are passed as input. Note that the data shape of the resulting report is “AssemblyReport.”
var properties = Resources["InfoTableFunctions"].
CreateInfoTableFromDataShape({
infoTableName : "InfoTable",
dataShapeName : "IEProperty"
});
properties.AddRow({
name : 'object_ref',
value: reportTemplateUfid
});
properties.AddRow({
name : 'input',
value: "name='" + partName + "'" + "," + "version='" + partRevision + "'"
});
var result = Things["ptc-windchill-demo-thing"].ExecuteTask({
params: properties,
dataShape: 'AssemblyReport',
uri: 'com/ptc/windchill/enterprise/report/ExecuteReportTemplate.xml',
objects: undefined /* INFOTABLE */
});
One other thing is all the examples given are used to get information from windchill. But i wish to create a Thingworx service which can create an entity(like part or document) in the windchill. Is there any examples that i can refer?
Thank in advance

