cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jimmydebie
Regular Visitor

Problem patching SP lists with nested table

I have a form where people can request articles to be shipped.

The form has 2 main datasources, a list called "TA Shipment REQ2" and a list called "Test article details".

 

The form is spread over 4 screens.

On one screen, the user can add multiple articles:

Collectioncreation.JPG

 

Add article, creates the collection:

OnSelect:ClearCollect(TestArticleCollection, {TestArticleItem: "", TiterItem: "", BatchNumberItem: "", DosesItem: 0, NumberofVialsItem: 0, ShelfLifeItem: "", PackagingItem: ""})

 

Save button:

OnSelect: 

Patch(
TestArticleCollection,
ThisItem,
{
TestArticleItem: TestArticleItem.Text,
TiterItem: TiterItem.Text,
BatchNumberItem: BatchNumberItem.Text,
DosesItem: Value(DosesItem.Text),
NumberofVialsItem: Value(NumberofVialsItem.Text),
ShelfLifeItem: ShelfLifeItem.Text,
PackagingItem: PackagingItem.Text
}
);
Collect(
TestArticleCollection,
{
TestArticleItem: "",
TiterItem: "",
BatchNumberItem: "",
DosesItem: 0,
NumberofVialsItem: 0,
ShelfLifeItem: "",
PackagingItem: ""
}
)

Updates the collection with the new data.

 

On the last screen, I want the user to be able to save the request to the main SP list "TA Shipment REQ2" and at the same time, save the articles to the other list, where the MasterID column should correspond with the ID column of the "TA Shipment REQ2" list.

submit.JPG

OnSelect: 

Patch('TA Shipment REQ2',Defaults('TA Shipment REQ2'),StudyInfo.Updates,StudyPaperWorkAttachments.Updates,StudyPaperWorkType.Updates,StudyPaperWork.Updates,GMPForm.Updates,TASenderInfo.Updates,TARecipientInfo.Updates)

 

To write the article data back to it's SP list, I've added following to the form on my last screen, where the Submit button resides:

 

OnSuccess: 

ForAll(
TestArticleCollection,
Patch(
'Test article details',
Defaults('Test article details'),
{
'Test Article/Material required': TestArticleItem,
Titer: TiterItem,
'Batch number': BatchNumberItem,
'Doses required': DosesItem,
'Number of Vials required': NumberofVialsItem,
'Required Minimal Shelf Life': ShelfLifeItem,
'Packaging (blister, box, number of vials per unit. ex.: 8 vials per box)': PackagingItem,
MasterID: StudyInfo.LastSubmit.ID
}
)
)

 

My main data is saved to the SP list "TA Shipment REQ2", what I can't get to work is having the additional article data saved to the other SP list "Test article details".

 

All help would be appreciated here, struggling on this since a while.

1 ACCEPTED SOLUTION

Accepted Solutions

@v-siky-msft 

Thanks for the suggestion.

 

I resolved it in creating a tabbed form (based on https://www.youtube.com/watch?v=if_mFIfi5PM) , this way I could submit 1 form and at the same time patch the nested table.

I didn't have issues with the LastSubmitted.ID part, didn't change this in my new form and worked.

 

Kind regards

Jimmy

View solution in original post

2 REPLIES 2
v-siky-msft
Community Support
Community Support

Hi @jimmydebie ,

 

What is the data type of MasterID column? Is it LookUp column, right?

If so, Please modify the code as follows.

ForAll(
TestArticleCollection,
Patch(
'Test article details',
Defaults('Test article details'),
{
'Test Article/Material required': TestArticleItem,
Titer: TiterItem,
'Batch number': BatchNumberItem,
'Doses required': DosesItem,
'Number of Vials required': NumberofVialsItem,
'Required Minimal Shelf Life': ShelfLifeItem,
'Packaging (blister, box, number of vials per unit. ex.: 8 vials per box)': PackagingItem,
MasterID: {
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: StudyInfo.LastSubmit.ID,
Value: StudyInfo.LastSubmit.ID
}
}
)
)

Hope this helps

Sik

@v-siky-msft 

Thanks for the suggestion.

 

I resolved it in creating a tabbed form (based on https://www.youtube.com/watch?v=if_mFIfi5PM) , this way I could submit 1 form and at the same time patch the nested table.

I didn't have issues with the LastSubmitted.ID part, didn't change this in my new form and worked.

 

Kind regards

Jimmy

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,822)