cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cyberco01
Post Prodigy
Post Prodigy

Multiple rows created when trying to add or delete rows

Hi Team,

I have a Sharepoint List linked to Powerapps. I have a repeating table in it.

When I add a new list item along with the rows in it. 2 list items are created in the SharePoint List.

When I remove the rows, additional row is created with the deleted one.

 

Please help. I am truely in need of guidance. Please do respond.

 

cyberco01_0-1634447437743.png

 

cyberco01_2-1634447500783.png

 

 

 

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
v-jefferni
Community Support
Community Support

I see another thread which has the same topic has been solved, link it below:

Solved: Re: Delete and Edit of rows in an existing list it... - Power Platform Community (microsoft....

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

12 REPLIES 12
Ramole
Resident Rockstar
Resident Rockstar

Hi @cyberco01 

 

Can you post your currant formula so we can amended

Thank you
If this post helps, then please consider Accept it as the solution to help the others and consider giving it a "Thumbs Up."

@Ramole 

OnSave:
-------
Set(
AllPurchasesString,
Concat(
Gallery1.AllItems,
Concatenate(
txtSrNo.Text,
"; ", ComboBox3.Selected.PERSONNELNUMBER,
//txtEmpNo.Text,
"; ", //ComboBox3.Selected.NAME,
txtEmpName.Text,
"; ",
txtPosition.Text,
" | "
)
)
);
Patch(
BonusRequests,
Defaults(BonusRequests),
{
//Title: Text(Today()),
//RepeatingSection: AllPurchasesString
Title: DataCardValue1.Text,
ProjNo: ComboBox1.Selected.PROJECTID,
MonthName:DataCardValue3.Selected,
RepeatingSection: AllPurchasesString
}
);
Notify(
"Record Submitted Succesfully!",
NotificationType.Success
);
Refresh(BonusRequests);
RequestHide()

 

OnEidt:
-------
Refresh(BonusRequests);
EditForm(SharePointForm1);
Set (RepSecCOllString, LookUp( BonusRequests, ID=SharePointIntegration.SelectedListItemID, RepeatingSection));Clear (InvoiceCollection);
Set (EditRepSecStr,LookUp( BonusRequests, ID=SharePointIntegration.SelectedListItemID , RepeatingSection));Set(EditRepSecStr,Left(EditRepSecStr,Len(EditRepSecStr) - 1));
ForAll (
Split (
EditRepSecStr,
"|"
),
Collect (
InvoiceCollection,
{
lblSrNo: Text (Last (FirstN(Split(Result,";").Result,1).Result).Result),
txtEmpNo: Text (Last (FirstN(Split(Result,";").Result,2).Result).Result),
txtEmpName: Text (Last (FirstN(Split(Result,";").Result,3).Result).Result),
txtPosition: Text (Last (FirstN(Split(Result,";").Result,4).Result).Result)
}
)
)

OnView:
-------
Refresh(BonusRequests);
ViewForm(SharePointForm1);
Set (RepSecCOllString, LookUp( BonusRequests, ID=SharePointIntegration.SelectedListItemID, RepeatingSection));Clear (InvoiceCollection);
Set (EditRepSecStr,LookUp( BonusRequests, ID=SharePointIntegration.SelectedListItemID , RepeatingSection));Set(EditRepSecStr,Left(EditRepSecStr,Len(EditRepSecStr) - 1));
ForAll (
Split (
EditRepSecStr,
"|"
),
Collect (
InvoiceCollection,
{
lblSrNo: Text (Last (FirstN(Split(Result,";").Result,1).Result).Result),
txtEmpNo: Text (Last (FirstN(Split(Result,";").Result,2).Result).Result),
txtEmpName: Text (Last (FirstN(Split(Result,";").Result,3).Result).Result),
txtPosition: Text (Last (FirstN(Split(Result,";").Result,4).Result).Result)
}
)
)

Ramole
Resident Rockstar
Resident Rockstar

Hi @cyberco01 

 

Is late for me here, will check it tomorrow but at moment try this

 

ForAll(
   AllPurchasesString, 
   Patch(
      BonusRequests, 
      Defaults(BonusRequests),
      {

//Title: Text(Today()),
//RepeatingSection: AllPurchasesString
Title: DataCardValue1.Text,
ProjNo: ComboBox1.Selected.PROJECTID,
MonthName:DataCardValue3.Selected,
RepeatingSection: AllPurchasesString
}
);
Notify(
"Record Submitted Succesfully!",
NotificationType.Success
);
Refresh(BonusRequests);
RequestHide()

 

 

Thank you
If this post helps, then please consider Accept it as the solution to help the others and consider giving it a "Thumbs Up."

@Ramole This did not work.

Now while saving, 2 list items are not created. However, while deleting a row from the repeating table. additional list item is created.

Ramole
Resident Rockstar
Resident Rockstar

Hi @cyberco01 

 

As it shows not the formula i provied you is working correctly not adding Multiple so now you will need to modify the other 

Thank you
If this post helps, then please consider Accept it as the solution to help the others and consider giving it a "Thumbs Up."
cyberco01
Post Prodigy
Post Prodigy

@Ramole how to correct the code so that while deleting rows in the repeating rows of an existing list, new list is not created.

Ramole
Resident Rockstar
Resident Rockstar

@cyberco01 

 

Outside button and will delete any item(s) selected from gallery checkbox

Remove(
  Splist,
    colSelected
);
Notify(
    "Records Deleted Successfully",
    NotificationType.Success
);
Clear(colSelected);
Reset(checkbox)

 Add a check box inside the gallery - 

OnCheck of check box add this 

Collect(colSelected,ThisItem)

 

OnUncheck

 

Remove(colSelected,ThisItem)

 

You can even make the delete button disappear if nothing is selected by adding this code on  Visible

 

Visible of the delete button outside 

CountRows(colSelected)>0

 

 

 

 

 


 

Thank you
If this post helps, then please consider Accept it as the solution to help the others and consider giving it a "Thumbs Up."
cyberco01
Post Prodigy
Post Prodigy

@Ramole ,

My form looks like below. Therefore, where should I add the Outside button code.

cyberco01_0-1634536087103.png

 

Ramole
Resident Rockstar
Resident Rockstar

@cyberco01 

 

Anywhere even on the top and test it 

Thank you
If this post helps, then please consider Accept it as the solution to help the others and consider giving it a "Thumbs Up."

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,327)