web
You’re offline. This is a read only version of the page.
close
Skip to main content
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 234
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
 
 
 
I have the same question (0)
  • Verified answer
    VeGETzX Profile Picture
    367 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
        )
    )
     
     
     
  • Johnolnes Profile Picture
    234 on at
    Display #order of selected item in a gallery
    Worked like a charm!
     
    Thanks @VeGETzX 

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Tom Macfarlan – Community Spotlight

We are honored to recognize Tom Macfarlan as our Community Spotlight for October…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 819 Most Valuable Professional

#2
developerAJ Profile Picture

developerAJ 541

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 423 Super User 2025 Season 2

Last 30 days Overall leaderboard