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

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (10,087)