cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
TCH
Level: Powered On

Help with building functionality

Hi guys, 

I have built an app for my company that essentially works as a lunch ordering app, in which my coworkers and I can order our lunch in the cantina, and the information about this will then automatically be sent to our HR lead that deals with salaries so she knows how much to charge us each month. 

Right now the app functions in such a way that one can order for the entire present week. However, lately colleagues have been requesting to up this to two weeks. This is where i need your help or inputs. As seen below this is how it works at the moment, where you are able to order monday through friday. 

Mandag t. Onsdag.PNGMy biggest concern with having to up this to two weeks, is the lack of understandings dates that PowerApps have. and right now to close orders for the day i am using this code: 

If(Or(Weekday(Today();Monday)>3;
And(Weekday(Today();Monday)=3;TimeValue(Text(Now()))>Time(09;30;00)));Disabled;DisplayMode.Edit)

As you can see i am using the numbers 1-7 to close the orders at 09:30 at a specific date, in the case above on wednesdays as Monday is the first day of the week here. 

The way it gathers data right now, is that the app patches to a SP list, and a flow then grabs the data from each day, where each day have specific list. The data is then inserted into an excel sheets which is sent off to the salary lady on the 15th of every month. 

Do any of you have a clever ideas on how to possibly extend something like this to two weeks? 

- Tobi 


1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Help with building functionality

Hi @TCH ,

Do you patch the selected items (with Checkbox checked) from your Gallery back to your SP List?

 

If you want to patch the selected items (with Checkbox checked) from your Gallery back to your SP List, I think the combination of ForAll function and Patch function could achieve your needs.

 

You could consider add a "Submit" button outside the Gallery, then set the OnSelect property to following formula:

ForAll(
       Filter(Gallery1.AllItems, Checkbox1.Value = true),
       Patch(
             'YourSPList',
              Defaults('YourSPList'),
              {
                 Title: "Data Entry",
                 OrderUser: User().DisplayName,
                 OrderDate: Value,     // Value represents the column property from the Gallery
                 ...
              }
       )
)

Note: The OrderUser, OrderDate, ... represents the columns in your SP list. The OrderUser column is used to store the user who submits order request. OrderDate column is used to store the date value when the user want to order.

 

More details about patch Gallery items back to SP List, please check and see if the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/How-to-patch-a-checkbox-from-a-gall...

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Need-assistance-with-patch-update-c...

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: Help with building functionality

Hi @TCH ,

Could you please share a bit more about your scenario?

Do you want to apply the "Close Orders" functionality to two weeks?

 

Based on the needs that you mentioned, I think the Gallery control could achieve your needs. I have made a test on my side, please consider take a try with the following workaround:

5.JPG

 

4.JPG

 

6.JPG

 

7.JPG

Set the OnStart property of App to following:

Clear(DateRanges);
ForAll(     // collect the date ranges from this Monday to next Sunday
        FirstN([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14], DateDiff(DateAdd(Today(), -Weekday(Today(), Monday)+1),DateAdd(Today(), -Weekday(Today(), Monday)+14))+1),
        Collect(DateRanges, DateAdd(DateAdd(Today(), -Weekday(Today(), Monday)+1), Value))
)

Add a Gallery, set the Items property to following:

DateRanges

add a Checkbox within above Gallery, set the Text property to following:

Switch(
       Weekday(ThisItem.Value, Monday),
       1, "Monday",
       2, "Tuesday",
       3, "Wednesday",
       4,"Thursday",
       5, "Friday",
       6, "Saturday",
       7, "Sunday"
) & "-" & ThisItem.Value

set the DisplayMode property of the Checkbox to following:

If(
    Or(
        Weekday(ThisItem.Value, Monday)>3,
        And(Weekday(ThisItem.Value, Monday)=3, TimeValue(Text(Now()))>Time(09,30,00))
    ),
    DisplayMode.Disabled,
    DisplayMode.Edit
)

Within above Gallery, it list two week dates, from this Monday to next Sunday.

 

Please check the attached sample app for more details. Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
TCH
Level: Powered On

Re: Help with building functionality

@v-xida-msft 

Yes, this does work, in terms of the design and interface. and thats great. 

The Displaymode seems to be a bit off, but that i can figure out from the already build app. 

But I think where i am really in a headache is with the "Backend" so the data manipulation. And finding out a way of making in so that it patches to a list in SharePoint in a smart way, so that it creates a list for each Unique day, if that makes sense? 😉 

- Tobi

Community Support Team
Community Support Team

Re: Help with building functionality

Hi @TCH ,

Do you patch the selected items (with Checkbox checked) from your Gallery back to your SP List?

 

If you want to patch the selected items (with Checkbox checked) from your Gallery back to your SP List, I think the combination of ForAll function and Patch function could achieve your needs.

 

You could consider add a "Submit" button outside the Gallery, then set the OnSelect property to following formula:

ForAll(
       Filter(Gallery1.AllItems, Checkbox1.Value = true),
       Patch(
             'YourSPList',
              Defaults('YourSPList'),
              {
                 Title: "Data Entry",
                 OrderUser: User().DisplayName,
                 OrderDate: Value,     // Value represents the column property from the Gallery
                 ...
              }
       )
)

Note: The OrderUser, OrderDate, ... represents the columns in your SP list. The OrderUser column is used to store the user who submits order request. OrderDate column is used to store the date value when the user want to order.

 

More details about patch Gallery items back to SP List, please check and see if the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/How-to-patch-a-checkbox-from-a-gall...

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Need-assistance-with-patch-update-c...

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,373)