cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (12,926)