cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mayarnaldo
Helper II
Helper II

Kanban Board - Gallery move to next lane

Hi,

 

So I created a Kanban Board. However, I am stuck on how gallery can move to another lane.

So when you check the checkbox and then click the arrow, the gallery can move from one lane to another (Created to Ready)

kanban_powerapps.png

 

 

I know I have to Patch it but I am stuck on the highlighted code. 

 

 

kanban_code.png

 

Can anyone help me with this? Thank you!

 

 

Regards,

May

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@mayarnaldo 

So, this is part of a larger context, meaning that there are a lot more aspects of your app that are needed to be known.

 

I have used this in similar apps before and it is fairly straight forward.

One of the keys (and I am noticing you have another post related to this) is to have an "Order" value associated with the Status.

What we do in the app:

1) There is a Horizontal Gallery.  The Items for that Gallery is set to all of the Statuses sorted by the "Order".

    Within the horizontal gallery is a Label that populates with the name of that status.  (note: we usually have a color associated with each status record as well and use that to fill the label)

 

2) The Horizontal Gallery has a Vertical Gallery nested in it.  The Items of that gallery are set to Filter(myDataSource, Status=ThisItem.Status)

    In the vertical gallery are labels and such to display relevant information along with a CheckBox to indicate selection for "lane change"

 

3) Now, to get the items to move on the left or right click, there is a Label in the Horizontal Gallery (it is not visible).  The text property of the Label is set to Concat(Filter(theVerticalGallery.AllItems, theCheckbox.Value), ID & ";")  (Note: all of the records in the galleries have an ID)

This will give a concatenated list of all of the "checked" items in the Gallery.

To get the combined list from all of the "lanes", there is a Label (also not visible) outside of the Galleries.  Its Text property is set to Concat(theHorizontalGallery.AllItems, theHiddenLabelMentionedAbove.Text)

This will then contain a concatenated list of all the Lanes.

 

4) Now...always hating to repeat a formula in two places:

    A) The Left Icon has the following in the OnSelect : UpdateContext({lclMoveLanes:"Left"})

    B) The Right Icon has the following in the OnSelect : UpdateContext({lclMoveLanes:"Right"})

    C) There is then a Toggle control on the screen (also hidden) that has the following:

        Default property : !IsBlank(lclMoveLanes)

        OnCheck Action:

ForAll(Split(combinedLabelOutsideOfGallery.Text, ";"),
    With({itm: LookUp(myDataSource, ID=Value(Result))},
        With({statOrder:LookUp(myStatusList, val=itm.Status, order)},
            With({newOrder:
                Switch(lclMoveLanes,
                    "Left", If(statOrder>1, statOrder-1, statOrder),
                    "Right", If(statOrder<CountRows(myStatusList), statOrder+1, statOrder)
                )},
                UpdateIf(myDataSource, ID=Value(Result),
                    {Status: LookUp(myStatusList, order=newOrder, val)}
                )                
            )
        )
    )
);

UpdateContext({lclMoveLanes:Blank()})

 

This will then move all selected items to either the right or left depending on which direction is pressed.

Works like a charm!

 

I hope this is relatively clear and helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

1 REPLY 1
RandyHayes
Super User
Super User

@mayarnaldo 

So, this is part of a larger context, meaning that there are a lot more aspects of your app that are needed to be known.

 

I have used this in similar apps before and it is fairly straight forward.

One of the keys (and I am noticing you have another post related to this) is to have an "Order" value associated with the Status.

What we do in the app:

1) There is a Horizontal Gallery.  The Items for that Gallery is set to all of the Statuses sorted by the "Order".

    Within the horizontal gallery is a Label that populates with the name of that status.  (note: we usually have a color associated with each status record as well and use that to fill the label)

 

2) The Horizontal Gallery has a Vertical Gallery nested in it.  The Items of that gallery are set to Filter(myDataSource, Status=ThisItem.Status)

    In the vertical gallery are labels and such to display relevant information along with a CheckBox to indicate selection for "lane change"

 

3) Now, to get the items to move on the left or right click, there is a Label in the Horizontal Gallery (it is not visible).  The text property of the Label is set to Concat(Filter(theVerticalGallery.AllItems, theCheckbox.Value), ID & ";")  (Note: all of the records in the galleries have an ID)

This will give a concatenated list of all of the "checked" items in the Gallery.

To get the combined list from all of the "lanes", there is a Label (also not visible) outside of the Galleries.  Its Text property is set to Concat(theHorizontalGallery.AllItems, theHiddenLabelMentionedAbove.Text)

This will then contain a concatenated list of all the Lanes.

 

4) Now...always hating to repeat a formula in two places:

    A) The Left Icon has the following in the OnSelect : UpdateContext({lclMoveLanes:"Left"})

    B) The Right Icon has the following in the OnSelect : UpdateContext({lclMoveLanes:"Right"})

    C) There is then a Toggle control on the screen (also hidden) that has the following:

        Default property : !IsBlank(lclMoveLanes)

        OnCheck Action:

ForAll(Split(combinedLabelOutsideOfGallery.Text, ";"),
    With({itm: LookUp(myDataSource, ID=Value(Result))},
        With({statOrder:LookUp(myStatusList, val=itm.Status, order)},
            With({newOrder:
                Switch(lclMoveLanes,
                    "Left", If(statOrder>1, statOrder-1, statOrder),
                    "Right", If(statOrder<CountRows(myStatusList), statOrder+1, statOrder)
                )},
                UpdateIf(myDataSource, ID=Value(Result),
                    {Status: LookUp(myStatusList, order=newOrder, val)}
                )                
            )
        )
    )
);

UpdateContext({lclMoveLanes:Blank()})

 

This will then move all selected items to either the right or left depending on which direction is pressed.

Works like a charm!

 

I hope this is relatively clear and helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (1,787)