cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Fricki97
New Member

Sort by Value

Hi,

I´ve got an App, which shows several Projects in a Gallery. The Projects are saved in a SQL-Table.

The Budget is sortet alphabetical and not by value. I set Budget as Value(Budget) but it wont sort it right. Did somebody got an Idea?

 

2022-08-29 10_59_59-Power Apps.png

 

 

 

Sort(
Source_with_filters_and_stuff;
Switch(
    DrpSort.SelectedText.Value;
    [...];
    "Budget";
    Value(Budget);
    [...]
    )
)

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Waegemma
Super User
Super User

Hi @Fricki97 ,

 

I can't recreate the issue here (it just works) but I might have a quick fix:

 

Sort(
Source_with_filters_and_stuff;
Switch(
    DrpSort.SelectedText.Value;
    [...];
    "Budget";
    Text(Budget;"000000000");
    [...]
    )
)

 

This should pad you Budget values with leading zeros, it will still sort alphabetically but because of the zeros it will look like it's sorted on Value. If you have Budgets of over 100 million, just add some zeros to the formula ...

 

Hope this helps,

 

Marc

View solution in original post

12 REPLIES 12
Waegemma
Super User
Super User

Hi @Fricki97 ,

 

I notice in the screenshot that the budget sum is preceded by "Budet :", could there be a spelling mistake in the original column name?

 

Marc

Its just a Mistake in the Label, not in the Data but thanks for the Info.

Waegemma
Super User
Super User

Hi @Fricki97 ,

 

Normally, if the column is of the Valuta type and you don't use Value(), the sort is ok. 

 

Sort(
Source_with_filters_and_stuff;
Switch(
    DrpSort.SelectedText.Value;
    [...];
    "Budget";
    Budget;
    [...]
    )
)

 

Is there a reason you use Value? 

 

Marc

 

I already tried but it´s the same result 😞

Waegemma
Super User
Super User

Could you post the complete sort formula? (without the [...])

Sort(
    If(
        IsBlank(TxtSearch);
        Filter(
            vP_Projects_for_SWOT;
            Mail = User().Email
        );
        Search(
            Filter(
                vP_Projects_for_SWOT;
                Mail = User().Email
            );
            TxtSearch.Text;
            "projectname";
            "projectnumber";
            "customernumber"
        )
    );
    Switch(
        DrpSort.SelectedText.Value;
        "Name";
        projectname;
        "Projektnummer";
        projectnumber;
        "Kundennummer";
        customernumber;
        "Budget";
        Budget;
        "Kostenstelle";
        costcenter;
        "Start";
        startingdate;
        "Ende";
        endingdate
    );
    If(
        DESC;
        Descending;
        Ascending
    )
)
Waegemma
Super User
Super User

Hi @Fricki97 ,

 

Thank you. I think the "Budget" option might be skipped. Could you try the following code to check this? I set the Budget sort as Default, so you don't have to select an item in the dropdown, this is just for testing:

 

Sort(
    If(
        IsBlank(TxtSearch);
        Filter(
            vP_Projects_for_SWOT;
            Mail = User().Email
        );
        Search(
            Filter(
                vP_Projects_for_SWOT;
                Mail = User().Email
            );
            TxtSearch.Text;
            "projectname";
            "projectnumber";
            "customernumber"
        )
    );
    Switch(
        DrpSort.SelectedText.Value;
        "Name";
        projectname;
        "Projektnummer";
        projectnumber;
        "Kundennummer";
        customernumber;
        "Kostenstelle";
        costcenter;
        "Start";
        startingdate;
        "Ende";
        endingdate;
        Budget
    );
    If(
        DESC;
        Descending;
        Ascending
    )
)
Waegemma
Super User
Super User

forgot to explain: your gallery should be sorted by Budget as a result

It is sorted by budget but still alphabetical

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,850)