Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Display #order of selected item in a gallery

(0) ShareShare
ReportReport
Posted on by 230
Hello! This feels as though it should be fairly simple, but I'm trying to work around it.
 
I have a gallery galDivInnvUtstyr which lets the user tick of for any item that is desired, and a text-input for the amount of that item:
 
 
The problem occurs when I'm trying to retreive the data that the user have previously saved in SharePoint.
The data that is passed to SharePoint is a text string using the code:
 
Diverse_x0020_innvendig_x0020_ut: {Value:
Concat(
Filter(
galDivInnvUtstyr.AllItems,
chDivInnvUtstyr.Value = true
),
txtDivInnvUtstyrAmount.Text&" x "&Value, " + "
      
)}.Value
 
The string looks like:
5 x Medisinkoffert på vegg + 2 x Papirhåndkle-holder (stor type) + 3 x Søppelkurv 12L + 2 x Såpedispenser (standard type)
 
I usually store this into a collection which i call colListe.
 
And I can split the string using the following:
 
Last(FirstN(Split(First(colListe).'Diverse innvendig utstyr'.Value, " + "),1)).Value
 
Which becomes:
5 x Medisinkoffert på vegg
 
I just can't find a way to dynamically alter the order of the number that corresponds to the order of the chosen item.
 
 
Now, displaying whether the user has chosen the item or not is fairly simple with the code in the checkbox:
 
If(
    chDivInnvUtstyr.Text in First(colListe).'Diverse innvendig utstyr'.Value,
    true
)
 
But displaying the amount of items the users has put in becomes hard.
 
 
Any tips?
 
Thanks in advance!
John
 
 
 
  • Johnolnes Profile Picture
    230 on at
    Display #order of selected item in a gallery
    Worked like a charm!
     
    Thanks @VeGETzX 
  • Verified answer
    VeGETzX Profile Picture
    364 on at
    Display #order of selected item in a gallery
    Hi,
     
    As per my try,

    I think the easiest way is to transform "5 x Medisinkoffert på vegg + 2 x Papirhåndkle-holder (stor type) + 3 x Søppelkurv 12L + 2 x Såpedispenser (standard type)" into collection that have two column to separate the item name and its quantity, so you can use formula just like
     
    txtQuantity.Text in colTest.Qty
    Find some event to create the collection may be screen's OnVisible or button OnSelect
     
    Replace TextInput1.Text with First(colListe).'Diverse innvendig utstyr'.Value
     
    ClearCollect(
        colTest,
        ShowColumns(
            AddColumns(
                AddColumns(
                    Split(
                        TextInput1.Text,
                        "+"
                    ),
                    TrimmedText,
                    Trim(Value)
                ),
                Qty,
                Trim(
                    First(
                        Split(
                            TrimmedText,
                            "x"
                        )
                    ).Value
                ),
                Name,
                With(
                    {
                        splitteds: Split(
                            TrimmedText,
                            "x"
                        )
                    },
                    Concat(
                        LastN(
                            splitteds,
                            CountRows(splitteds) - 1
                        ),
                        Value,
                        ""
                    )
                )
            ),
            Name,
            Qty
        )
    )
     
     
     

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1