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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Display #order of sele...
Power Apps
Unanswered

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
 
 
 
Categories:
I have the same question (0)
  • Verified answer
    VeGETzX Profile Picture
    367 on at
    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
    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 759 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 310 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 228

Last 30 days Overall leaderboard