Skip to main content
Apr 13, 2020 7:57 AM UTC
Solved

regarding Value Stream transaction

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!

tallrainAnswer
Apr 28, 2020 1:11 AM UTC

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;

6 replies

Apr 13, 2020 2:53 PM UTC

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.

tallrainAuthor
Apr 14, 2020 3:06 AM UTC

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.

Apr 24, 2020 2:49 PM UTC

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

tallrainAuthorAnswer
Apr 28, 2020 1:11 AM UTC

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;