cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SahilVasani
Frequent Visitor

PATCH AND COLLECT FUNCTION ISSUE

All About Community Badges 

I am a new developer in power apps.

 

I have 2 lists; 'Product List' & 'Sub FJO'. I have 1 column in sharepoint called "product name" in the Sub FJO list (it is a lookup column which gets the data from the master list 'Product List'.

 

I have tried a similar approach to this article here for reference: Repeating Tables in Power Apps using SharePoint List Form 2.0 (anjcerbolles.com) 

 

I have been trying to get the combo box to work with the collect and clear collect. 

 

The issue is that when i add a new row in the gallery, the combo box data for row 1 disappears. I then later have to add the values again to the combo box after adding several columns. The patch does work correctly.

 

Clear Collect Function:

 

NewForm(CreateItemForm);
ClearCollect(
colInvoice,
{
LineItem: "",
LinePrice: "",
LineQty: "",
LinePayment: false,
LineProduct: ""
}
);
Set(
SharePointFormMode,
"CreateForm"
);
Navigate(
CreateScreen,
Transition.None
)

 

Combo Box Items Function: 

 

Choices([@'FJO - Sub FJO'].ProductName)

 

Patch Function:

 

Patch(
colInvoice,
ThisItem,
{
LineItem: txtItemNameCreate.Text,
LinePrice: Value(txtPriceCreate.Text),
LineQty: Value(txtQtyCreate.Text),
LineProduct: ComboBox4.Selected.Value
}
);
Collect(
colInvoice,
{
LineItem: "",
LinePrice: "",
LineQty: "",
LinePayment: false,
LineProduct: ""
}
)

 

Form Submission on Success Function: 

 

ForAll(
CreateGalleryItems.AllItems,
If(
!IsBlank(txtItemNameCreate.Text),
Patch(
'FJO - Sub FJO',
Defaults('FJO - Sub FJO'),
{
Title: CreateItemForm.LastSubmit.Title,
'Sub FJO Number': txtItemNameCreate.Text,
'TEST COLUMN': Value(txtPriceCreate.Text),
Quantity: Value(txtQtyCreate.Text),
'Product Name': ComboBox4.Selected
}
)
)
);
ResetForm(Self);
RequestHide();

 

 

0 REPLIES 0

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Users online (2,275)