cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Issue navigating with a gallery

I am going to try and explain my issue as well as I can. I understand what is going on but not hyw or how to solve it. 

 

I am making a "service desk"-type app. I have a gallery with a summary of the case (summary screen). When you press a specific case you are navigated to another screen with more detailed information (data screen). On this data screen I use the Gallery.Selected.X command to display the data. This work as intended. The issue appears when I am trying to update the case information. I am using the Patch() function to update the case data. If I update a case with a value that is affected by the SortByColumns all the Gallery.Selected.X-values on the data creen changes because the order in the gallery changes.  This to me is strange. The command is called ThisItem.Selected, but it does not display the case I actually selected. 

 

Gallery code:

SortByColumns(
    SortByColumns(
        SortByColumns(
            Filter(
                Cases,
                TI_sök_art.Text in Text(SKU),
                TI_sök_butik.Text in Text(Store_x0020_ID) & Text(Store_x0020_Name),
                TI_sök_namn.Text in Text(Name),
                TI_sök_efternamn.Text in Text(Surname),
                TI_sök_ärende.Text in Text(Case_x0020_ID),
                TI_sök_serienummer.Text in Text(Serial_x0020_No_x002e_)
            ),
            "Created_x0020_Date",
            Descending
        ),
        "Sort",
        Ascending
    ),
    "Closed",
    Ascending
)

Example:

 

 

CaseTable:

CaseIDSortData
I1A
II2B
III3C
IV4D
V6E

 

Lets say I press CaseID III.

I am navigated to the data screen where  "label1" displays "C" using Gallery.Selected.Data, so far so good.

I patch the Sort column of case III from 3 to 7.

Now label1 display "D"

This means Galley.Selected does not display the case I selected since the order in the gallery has changed. If I remove the SortByColumns command everything works as intended. 

 

How can I sort the gallery but still beeing able to patch the case without Gallery.Selected being affected?

 

I hope I have made this clear enough for you to understand. Please tell me if you need additional information to help me. 

 

Cheers,

Joakim

 

1 ACCEPTED SOLUTION

Accepted Solutions
TimRohr
Solution Sage
Solution Sage

Unfortunately, you can't locate to a particular record in a Gallery (at least, not yet). That said, you can fudge this a little bit using the Default property of the Gallery and a Reset() command.

 

Before your Patch(), capture the ID of the record you're updating... something unique. Pass it into the summary screen as a context variable in your Navigate() statement.

 

Have the Gallery's Default property reference the record that bears that unique identifier in a First(Filter()) construction.

 

Then, when you navigate to the summary page, perform a reset on the Gallery, and your "new" default record (the one you just updated) should be selected. 

 

Post back if you need more details.

View solution in original post

2 REPLIES 2
TimRohr
Solution Sage
Solution Sage

Unfortunately, you can't locate to a particular record in a Gallery (at least, not yet). That said, you can fudge this a little bit using the Default property of the Gallery and a Reset() command.

 

Before your Patch(), capture the ID of the record you're updating... something unique. Pass it into the summary screen as a context variable in your Navigate() statement.

 

Have the Gallery's Default property reference the record that bears that unique identifier in a First(Filter()) construction.

 

Then, when you navigate to the summary page, perform a reset on the Gallery, and your "new" default record (the one you just updated) should be selected. 

 

Post back if you need more details.

Anonymous
Not applicable

This solution worked like a charm! Thank you very much for taking the time to reply, I appriciate it.

 

Cheers,

Joakim

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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