Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hi guys,
I've a question regarding Value Stream transaction.
My platform is 8.5.
Now I have a Thing, which has 20 attributes and a Value Stream assigned for it.
I wrote a service to read data from a Data Table and to update all these 20 attributs in the same time.
After running service, I found 10 attributes are updated in one record of Value Stream, and the other 10 attributs are updated in another record of Value Stream.
But I need to make sure all 20 attrubuts are updated in the same record of the Value Stream, I need this information for Analytics.
Do we have some kind of transaction mechanism of Value Stream? Or any other way to make sure the timestamp are same?
Thanks a lot!
Solved! Go to Solution.
Update:
I used UpdatePropertyValues to make sure to update all attribute in the same moment
var params = {
infoTableName : "InfoTable",
dataShapeName : "NamedVTQ"
};
// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(VSTestDataShape)
var tempDable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
var time = new Date();
tempDable.AddRow({
time: time,
name: "F1",
quality: "GOOD",
value: 71
});
tempDable.AddRow({
time: time,
name: "F2",
quality: "GOOD",
value: 72
});
tempDable.AddRow({
time: time,
name: "F3",
quality: "GOOD",
value: 73
});
tempDable.AddRow({
time: time,
name: "F4",
quality: "GOOD",
value: 74
});
tempDable.AddRow({
time: time,
name: "F5",
quality: "GOOD",
value: 75
});
me.UpdatePropertyValues({
values: tempDable /* INFOTABLE */
});
var result = tempDable;
The service SetPropertyValues takes an infotable of all the properties and their values. This will write them all at the same time with the same time stamp.
Thank you! I tried this method, but same issue still exist.
Now I will add a new Info Table Attribute, and put all features into that Info Table, so each time I will only update one Attribute in Value Stream level. Will check it.
Hi @tallrain.
We would recommend opening a case for this issue so that one of our engineers can schedule a WebEx to see what is happening. I will be happy to open the case on your behalf if you would like to proceed in this manner.
Regards.
--Sharon
Thank you, I resolved it with UpdatePropertyValues instead.
Hi @tallrain.
Glad to hear you resolved it. Please mark your post as the Accepted Solution for the benefit of others on the community.
Regards.
--Sharon
Update:
I used UpdatePropertyValues to make sure to update all attribute in the same moment
var params = {
infoTableName : "InfoTable",
dataShapeName : "NamedVTQ"
};
// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(VSTestDataShape)
var tempDable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
var time = new Date();
tempDable.AddRow({
time: time,
name: "F1",
quality: "GOOD",
value: 71
});
tempDable.AddRow({
time: time,
name: "F2",
quality: "GOOD",
value: 72
});
tempDable.AddRow({
time: time,
name: "F3",
quality: "GOOD",
value: 73
});
tempDable.AddRow({
time: time,
name: "F4",
quality: "GOOD",
value: 74
});
tempDable.AddRow({
time: time,
name: "F5",
quality: "GOOD",
value: 75
});
me.UpdatePropertyValues({
values: tempDable /* INFOTABLE */
});
var result = tempDable;