Solved
Bulk update the Attributes of the Documents in Windchill
Hi.
I have a couple of Attributes in Windchill, around 3000+ documents. Where the attribute values need updating. Manually, it will take Days and weeks to update.
Thanks.
Hi.
I have a couple of Attributes in Windchill, around 3000+ documents. Where the attribute values need updating. Manually, it will take Days and weeks to update.
Thanks.
let csvData = Resources["CSVParserFunctions"].ReadCSVFile({
path: "All.csv",
hasHeader: true,
fileRepository: "FileRepository",
dataShape: "AutoUploadCSV.DS"
});
let distinctData = me.getWrongMachineModelData();
for(let x = 0; x < distinctData.length; x++)
{
try
{
let response = Things["windchill-Odata-connector"].GetDocuments({
$filter: "Number eq '"+distinctData.rows[x].SBNumber+"'",
$select: "ID,VersionID"
});
try
{
let checkOut = Things["windchill-Odata-connector"].docuemntCheckout({
ID: response.value[0].ID
});
} catch(e){}
let response2 = Things["windchill-Odata-connector"].GetDocuments({
$filter: "Number eq '"+distinctData.rows[x].SBNumber+"'",
$select: "ID,VersionID"
});
let Model = [];
let distinctDataSBMM = Resources["InfoTableFunctions"].Query({
t: csvData,
query: {
"filters": {
"type": "EQ",
"fieldName": "SBNumber",
"value": distinctData.rows[x].SBNumber
}
}
});
distinctDataSBMM = Resources["InfoTableFunctions"].Distinct({
t: distinctDataSBMM,
columns: "SBNumber,MachineModel"
});
for(let y = 0; y < distinctDataSBMM.length; y++)
{
Model.push({
"Value": distinctDataSBMM.rows[y].MachineModel,
"Display": distinctDataSBMM.rows[y].MachineModel
});
}
let updateDocument = Things["windchill-Odata-connector"].updateDocument({
ID: response2.value[0].VersionID,
Document: {
"@odata.type": "#PTC.DocMgmt.SalesBrochure",
"Model": Model
}
});
result = updateDocument;
} catch(e){}
}
--
Thanks.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.