Skip to main content
12-Amethyst
April 13, 2020
Solved

regarding Value Stream transaction

  • April 13, 2020
  • 2 replies
  • 2107 views

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!

Best answer by tallrain

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;

2 replies

1-Visitor
April 13, 2020

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.

tallrain12-AmethystAuthor
12-Amethyst
April 14, 2020

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.

Community Manager
April 24, 2020

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

tallrain12-AmethystAuthorAnswer
12-Amethyst
April 28, 2020

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;