Hi all,
I need to append a new value to a multi-value selection lookup column. The challenge is how to get the IDs of the new values in one SharePoint list and append them to another SharePoint list with new item.
The user creates new items in the collection. He starts with the manufacturer, then the model and creates and appends the controller.
(1) Create new items
Creating new manufacturer:
Collect(colManufacturer;
{
Manufacturer: Upper(txtManu.Text);
New_entry: true;
Category: "Manufacturer"
}
);;
Creating new model:
Collect(
colModellseries;
{
field_2: txtModellserie_2.Text;
ElevatorManufacturer : {
Id: varManuSelected.ID;
Value:varManuSelected.field_2};
Category: "Modellseries"
}
);;
Create new controller:
Collect(
colController;
{
ControllerManufacturer:{Value:ControllerManuSearchView.Selected.Result};
ControllerType:txtControllerLib_Modell.Text;
ControllerArt:{Value:Radio_Art_3.Selected.Value};
EleManufacturer : {
Id:varElevatorManufacturerSelected.ID;
Value:varElevatorManufacturerSelected.field_2};
Category: "Controller"
}
));;
(2) Bulk import after workday
Now after the workday, the user wants to bulk upload each newly created item and have the right relationship in the sharepoint.
Here is my attempt:
// Bulk upload
// patch only blank title values from collection
//Ingest NEW Manufacturer & get ID Value
Set(gblLastManuPatched;ForAll(Filter(colManufacturer;
Not(!IsBlank(Title)));
Patch(ManufacturerLib;
Defaults(ManufacturerLib);{
Manufacturer:Manufacturer
})
));;
//The same for Model as Manufacturer
//Ingest NEW Controller & get ID Value & set Relationship right
Set(gblLastControllerPatched;ForAll(Filter(colKontroller;
Not(!IsBlank(Title)));
Patch(ControllerLib;
Defaults(ControllerLib);{
Title:Last(ControllerLib).ID+1;
ControllerManufacturer: ControllerManufacturer;
ControllerType: ControllerType;
ControllerArt:ControllerArt;
//HERE I NEED TO GET LAST ID FOR RELATIONSHIP
Manufacturer: {
Id:gblLastManuPatched.ID;
Value:gblLastManuPatched.Manufacturer};
Modelseries: Modelseries;
Compatible:Compatible
})
);;
I think I need to use Set() with Filter() and ForAll(). I thought also to use make a new collection which stores the record back ID of new items.
(1) Save item to the collection
(2) Save new items with the new ID corresponding to the record ID (in a new collection?)
(3) Use the new ID of the element and use the corresponding ID for the correct relationship between the others.
Any help will be greatly appreciated.

Report
All responses (
Answers (