Dear All,
I'm trying to create a gallery table, where I want to add a column with the predicted hours, just like the vlookup on excel, having task name as my reference. However, it is only picking the first value of my prediction and copying the same for the entire table. My code and intermediate JSON results look like the following:
ClearCollect(
PredictionResults,
tasks_estimator.predicttask({
base_item_code: Concat(FilteredDataTable, ProductCode & ":"),
customer: customername,
offering_category: ProjectTypeDropdown.Selected.Value,
country: Dropdown_Country.Selected.Value,
region: Dropdown_Region.Selected.Value
})
);
ClearCollect(
TaskCollection,
ForAll(
Sequence(CountRows(First(PredictionResults).'1_predicted_task_names')),
{
TaskName: Index(First(PredictionResults).'1_predicted_task_names', Value).Value,
TotalPredictedHours: Index(First(PredictionResults).'2_predicted_task_hours', Value).Value
}
)
);
JSON(TaskCollection) - RESULTS of my prediction data coming from a machine learning model through a custom connector
[{"TaskName":"Other costs","TotalPredictedHours":94.398},{"TaskName":"Integration Work","TotalPredictedHours":54.921499999999995},{"TaskName":"Training","TotalPredictedHours":94.398},{"TaskName":"Engineering Work","TotalPredictedHours":78.1025},{"TaskName":"Project Management","TotalPredictedHours":41.467},{"TaskName":"Quality & other costs","TotalPredictedHours":19.779},{"TaskName":"Factory Inspection T","TotalPredictedHours":26.664},{"TaskName":"Installations & SAT","TotalPredictedHours":23.406000000000002}]
ClearCollect(
MergedTaskSummaries,
ForAll(
TaskSummaries,
{TaskName: ThisRecord.TaskName,
TotalQuantity: ThisRecord.TotalQuantity,
TotalPredictedHours: If(
IsBlank(LookUp(TaskCollection, TaskName = ThisRecord.TaskName, TotalPredictedHours)),
"N/A",
LookUp(TaskCollection, TaskName = ThisRecord.TaskName, TotalPredictedHours)
)
}
)
);
JSON(MergedTaskSummaries) - FINAL RESULT OF MY GALLERY
[{"TaskName":"Project Management","TotalPredictedHours":"94.398","TotalQuantity":4},{"TaskName":"Integration Work","TotalPredictedHours":"94.398","TotalQuantity":2},{"TaskName":"Installations & SAT","TotalPredictedHours":"94.398","TotalQuantity":7},{"TaskName":"Engineering Work","TotalPredictedHours":"94.398","TotalQuantity":2},{"TaskName":"Factory Inspection T","TotalPredictedHours":"94.398","TotalQuantity":1},{"TaskName":"Other costs","TotalPredictedHours":"94.398","TotalQuantity":null},{"TaskName":"Quality","TotalPredictedHours":"94.398","TotalQuantity":null},{"TaskName":"Training","TotalPredictedHours":"94.398","TotalQuantity":2},{"TaskName":"Factory Acceptance T","TotalPredictedHours":"94.398","TotalQuantity":null},{"TaskName":"Site Survey","TotalPredictedHours":"94.398","TotalQuantity":null}]
What's the best way to merge the results of my taskcollection table with the already present task summaries table?
Thanks!