web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Split gallery items in...
Power Apps
Answered

Split gallery items into multiple items dynamically

(0) ShareShare
ReportReport
Posted on by 593

I have a below powerapp gallery with SharePoint as the datasource. 

 

Iantaylor2050_0-1681530069753.png

If I click on split icon at the extreme right, it should show me a pop-up box, where I can perform split of the item selected. The pop-up box should look something like below. I should be able to split the selected item into any number of items. Hence I should have the + icon in the pop-up for me to add number of rows.

 

Iantaylor2050_1-1681530228522.png

 

Once I click on save, all the split items should get saved into the gallery and the original items should get deleted. Any idea how to achieve this?

 

Categories:
I have the same question (0)
  • Verified answer
    JohnM86 Profile Picture
    590 on at

    To achieve this functionality, you can use a combination of a pop-up dialog box and a collection to temporarily store the split items. Here are the high-level steps to implement this:

    1. Create a new screen in your app for the pop-up dialog box. Add an input field for the number of split items and a "+" button to add more rows if needed.

    2. In the OnSelect property of the split icon in the gallery, set a variable to the selected item and use the Navigate function to go to the pop-up dialog box screen.

    3. In the OnSelect property of the "+" button in the pop-up dialog box, use the Collect function to add a new row to a collection. Use the same fields as the original SharePoint list, but set the declaration number to the declaration number of the original item plus the index of the new row in the collection (e.g., OriginalItem.DeclarationNumber + CountRows(SplitItems)).

    4. In the OnSelect property of the Save button in the pop-up dialog box, use a ForAll loop to create new items in the SharePoint list for each row in the collection. Use the Patch function to set the fields of each new item based on the corresponding row in the collection. Then use the Remove function to delete the original item.

    5. After the loop is complete, use the Back function to return to the gallery screen.

    Here is an example formula for the Save button:

    ForAll(SplitItems, Patch('SharePointList',
    Defaults('SharePointList'),
    {
    Title: ThisRecord.Title,
    DeclarationNumber: ThisRecord.DeclarationNumber,
    ItemNumber: ThisRecord.ItemNumber,
    Quantity: ThisRecord.Quantity,
    Price: ThisRecord.Price
    }
    ));
    Remove('SharePointList', Gallery1.Selected);
    Navigate(Screen1, None)

     

    This formula assumes that the collection is named SplitItems, the SharePoint list is named SharePointList, and the gallery is named Gallery1. Adjust the field names and control names as needed for your app.

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard