Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Good day Community,
I have a stream and I write to this stream in serviceA.
The stream has a field of type infotable.
So when adding a row to the stream in serviceA, I do not add anything to the nested infotable yet.
I have service B where I intend to write to the nested infotable.
This is my code:
let Stream = Shaft_Name;
// result: INFOTABLE dataShape: ""
let Stream_Data = Things[Stream].QueryStreamEntriesWithData({
oldestFirst: undefined /* BOOLEAN */,
maxItems: undefined /* NUMBER {"defaultValue":500} */,
sourceTags: undefined /* TAGS */,
endDate: undefined /* DATETIME */,
query: undefined /* QUERY */,
source: undefined /* STRING */,
startDate: undefined /* DATETIME */,
tags: undefined /* TAGS */
});
let Updated_Info = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
infoTableName: "InfoTable",
dataShapeName: "ShaftSinkingCycleDelayInfo_DS"
});
let len = Stream_Data.length;
let Activity_Unique_Id;
let Delay_Info;
for(let i=0; i<len; i++){//Looping through the stream
Activity_Unique_Id = Stream_Data[0].activity_unique_id;//get the specific row to update
input
let x = Activity_Unique_Id;
Updated_Info.AddRow({delay_id:x});
Things["Stream"].AddStreamEntry({
sourceType: undefined /* STRING */,
values: Updated_Delay_Info /* INFOTABLE */,
location: undefined /* LOCATION */,
source: me.name /* STRING */,
timestamp: undefined /* DATETIME */,
tags: undefined /* TAGS */
});
Updated_Info.RemoveAllRows();
}
let result = Stream_Data[Delay_Information];//outputting the nested infotable
I do not get the nested infotable.
How can do I write to a column inside a nested infotable?
Regards,
Solved! Go to Solution.
for(let i=0; i<len; i++){//Looping through the stream
Activity_Unique_Id = Stream_Data[0].activity_unique_id; //get the specific row to update
If you want to iterate and not always assign the first row of of the stream to "Activity_Unique_Id", you should change the [0] to [i].
EDIT: I am missing some context to your service snippet. Because your variable "Updated_Delay_Info" that you put in your "value" property is nowhere defined. And a few other things...
Anyhow: The "values" infotable for "AddStreamEntry" must be the datashape that is used for the stream entity. I am not sure if that is "
for(let i=0; i<len; i++){//Looping through the stream
Activity_Unique_Id = Stream_Data[0].activity_unique_id; //get the specific row to update
If you want to iterate and not always assign the first row of of the stream to "Activity_Unique_Id", you should change the [0] to [i].
EDIT: I am missing some context to your service snippet. Because your variable "Updated_Delay_Info" that you put in your "value" property is nowhere defined. And a few other things...
Anyhow: The "values" infotable for "AddStreamEntry" must be the datashape that is used for the stream entity. I am not sure if that is "