Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Multi select from list and then save selected items with Qty

(0) ShareShare
ReportReport
Posted on by 67

Hi Power Apps Community members,

 

I'm going in circles to achieve the following:

I have created a list of (inventory) items, with checkboxes. When user checks the items they want, they have the option to select the quantity. After setting the qty for each selected items, they can save them. It will be clear from the image

items.PNG

As you can see, the selection part is working.

What I'm trying to achieve is, although the users will see the item description, I want to take the item_id instead, in the collection and when the quantity is selected, the item_id and item_quantity will be saved as new records in a DB table (MS SQL)

The item_id, description & item_ref are in the same Inventory table

Most of the time, the users are not aware of item_id, unless a few common items.

OnCheck checkbox, I tried this:

 

Collect(CollectItems,ThisItem)
/*
Collect(CollectItems,
 ItemDesc:ThisItem,
 ItemCode: LoopUp(inventory,item_ref = Value(scannedValue2) || item_id = Value(TextSearch2.Text)).item_id,
// ItemQty: Dropdown1.Value,
) */

 

Please don't get confused by the item_ref, Its the item_id which is important.

 

I understand, I have to use a ForAll with a Patch function, but don't know exactly how to use the proper syntax!

 

I read many related articles but not able to find anything close.

Any advise, how I can insert all the records and Qty from the second Gallery (green box) when user click a Submit button, will be really helpful.

 

Thanks

 

Categories:
  • Nicci Profile Picture
    194 on at
    Re: Multi select from list and then save selected items with Qty

    This helped thank you!

  • ozzie14 Profile Picture
    67 on at
    Re: Multi select from list and then save selected items with Qty

    By recalling the screen, if you mean retrieving the data to read/edit, then yes, I have created that.

     

    When we create an app to let users insert data, there should always be a way (page) to retrieve and edit the existing data. Transactional data, which (partly or fully) are added by user (and not derived) should have an option for edit, for error handling.

     

    In my app, the users has an option to alter the item quantity, remove the item entirely and/or add a new item.

    For the existing items, I have used a Collection, which gets updated when user edits any item. The changes are saved only when user hits Submit/Save button.

     

    I've used a ForAll and Patch function to loop through the records to update or overwrite.

     

    Hope that helps.

  • Nicci Profile Picture
    194 on at
    Re: Multi select from list and then save selected items with Qty

    THANK YOU! This was absolutely helpful! Out of curiousity, does your app have the ability to recall this screen? I am done building the gallery to be able to select and add quantity for the ticket. I'm still working on how to save the data into my items used on tickets table, but trying to figure out how to recall the information back using the same gallery if they open this to add more materials or even remove more materials and what the patch function looks like. This may be too big to ask here, but i figured i'd give it a shot 😄

  • ozzie14 Profile Picture
    67 on at
    Re: Multi select from list and then save selected items with Qty

    I understand your requirement. 

     

    In the second UI, there is also a selection of items option (manual or scanning of barcode or QR code). It looks like this:

    gallery.PNG

     

    The screenshot is from a Dev environment. The Prod page displays only the 3 columns from right which saves space, since I had to include several other user input boxes, dropdowns etc.

     

    Hope that helps in your project.

     

  • Nicci Profile Picture
    194 on at
    Re: Multi select from list and then save selected items with Qty

    Sure so what I have is a ticket system to print stuff and I need a screen to add like a materials used to that ticket. We have a database list with all the material types already so I need a way for users to select which materials from the list of available materials and how many and save that so I liked your idea in the first post to have some sort of selection, add it to the side and then add quantity, but wasn't sure how to go about building it.

    In your latest screen show is that just a massive list of items and if they didnt use it then they can just leave quantity blank? our list would be pretty long to scroll down doing it that way.

    Thanks so much for the help!!

  • ozzie14 Profile Picture
    67 on at
    Re: Multi select from list and then save selected items with Qty

    Hi Nicci,

     

    In the screenshot which I posted in the beginning, there are two collections. The checkbox in the LHS gallery, when checked, was populating the second collection (RHS gallery). The users then select a quantity from the dropdown against the selected items (in RHS gallery). There is no checkbox to set the quantity.

     

    If that doesn't answer your question, then can you please explain in a little more detail what you want to achieve?

     

    FYI, I later changed the UI to one Gallery from a single collection (to make use of screen real-estate), where users can add quantity and remove the item completely. (screenshot below)

     

    gallery.PNG

     

    Cheers.

     

  • Nicci Profile Picture
    194 on at
    Re: Multi select from list and then save selected items with Qty

    Hello! I'm trying to do pretty much exactly what you have here. Can you please share how you did the check box with the list of checked items to set quantity please? Thank you so much!

  • ozzie14 Profile Picture
    67 on at
    Re: Multi select from list and then save selected items with Qty

    Both of your suggestion works perfectly!!

     

    Thank you...

  • Verified answer
    v-jefferni Profile Picture
    on at
    Re: Multi select from list and then save selected items with Qty

    Hi @ozzie14 ,

     

    You can simply modify the collect function:

    Collect(CollectItem,
    {
     item_desc:ThisItem.Description,
     item_code:LookUp(inventory, item_ref = Value(scannedValue) || item_id = Value(TextSearch2.Text)).item_id
    }
    )

     

    Best regards,

  • ozzie14 Profile Picture
    67 on at
    Re: Multi select from list and then save selected items with Qty

    Hi JefferNi,

     

    The Collect function is not working as expected!

    In the OnCheck checkbox in red Gallery I used this code:

     

     

     

    Collect(CollectItem,
    {
     item_desc:ThisItem,
     item_code:LookUp(inventory, item_ref = Value(scannedValue) || item_id = Value(TextSearch2.Text)).item_id
    }
    )

     

     

     

    Error I'm getting is 'Incompatible type. Collection can't contain values of this type'

    & ThisItem = This formula uses scope, which is not presently supported...

    If I use: 

    Collect(CollectItems,ThisItem)

    Only then the green gallery is working.

     

    The datatype in the inventory table are:

    item_id (int)

    description (nvarchar)

     

    I was trying to create the CollectItem with two columns: description & item_id, display only the description col for the users, and OnClick the Submit button, insert the item_ids from the CollectItem, with the quantity value in the dropdown, to a DB table.

     

    Any suggestion to the right direction will be really helpful.

     

    Thanks

    Ozzie

     

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,653 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard