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
Saran,
The error message "Unable to process I*E query" seam to indicate possible Windchill error but I can't say for sure without seeing the logs. Can you package the Windchill and ThingWorx entities you created and attach it here. Also please attach the TWX and WC logs. That will help us understand the issue you are facing.
--Marek
Hi Marek,
Thanks for your reply. I had found the windchill error.The "Part Assembly" reoport template was missing. So i tried with other entity and it works fine.
Regards,
Saran