Date Ranges and working day calculation PowerApps, Leave Management (Chinese Holiday Calendar)

Scenario:

User is applying for leaves by selecting Start Date and End Date with date pickers. You have to calculate working days between the two dates. General formula being:

Working Days = (End Date – Start Date)- Weekends – Holidays

Points to note:
  1. Exclude weekends.
  2. Exclude holidays (holidays are in ranges. Refer to calendar here for more/sample information).
  3. Working weekends.

Implementation:

During a PowerApps development assignment recently, I came across this scenario. It was unique, new and felt challenging.

How did I set up?

Created a SharePoint Online development tenant. Created master lists for- Holidays, Weekend Working and User Leave Requests.

LMS_MasterListsLMS_WorkingWeekendLMS_Holidays

∗∗∗Microsoft has provided a sample template here. It has useful resources and rich in information.

Date functions from PowerApps resources does help a lot here.

Functionality to calculate working dates between two dates is fairly simple. Refer to this article and the sample template shared above.

The trick and challenge awaits us when we are doing Holiday calculation. You can create a new collection if “Holidays” are individual days similar to weekend working items. However, if the holidays are in ranges (example above) you are in for a treat and a good one too.

This post really helped in building the base on the calculation. Added a wee bit of my brain and eureka… a working solution is available. Here is the magical code:

Clear(HolidayDateRange);
ForAll(
    HolidaysCalendar,
    Collect(
        HolidayDateRange,
        AddColumns(
            FirstN(
                [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29],
                DateDiff(HolidayStartDate, HolidayEndDate, Days) + 1),
            "Day",
                "Day " & (Value + 1),
            "Date",
                DateAdd(HolidayStartDate, Value, Days)
        )
    )
)

I have used the “OnVisible” event of my welcome screen to populate this collection.

Here is the variable which stores the Holidays falling in my leave date selection..condition- should be a working day.

Set(_holidaysInRequest, CountIf(HolidayDateRange, Date >= LeaveStartDatePicker.SelectedDate, Date <= LeaveEndDatePicker.SelectedDate,Weekday(Date) in [2,3,4,5,6]));

Last but not the least, the duration calculation:

Set(_requestedDays, (_workDaysInRequest +_workingWeekendsInRequest) - (_holidaysInRequest))

Variable “_workDaysInRequest” has only the weekdays (no weekends).

#HappyToHelp #Community #SharingIsCaring #GivingBack

Tool- SharePoint modernization scanner

  • Are you planning to move your SharePoint implementation to Cloud a.k.a O365?
  • Do you believe you can relax for next few years after moving to cloud?
  • You are using classic site you want to modernize your classic site?

If you answered any of the questions yes, this post is for you.

Vesa Juvonen, a principal program Manager at Microsoft during SharePoint developers talk, has suggested that “Modern is the future” for SharePoint. As the first step for an organization utilizing the older version of SharePoint technologies is to analyze, before replacing them. To help you in the process and make it more effective; use – SharePoint Modernization Scanner. It is the recommended approach and tool from Microsoft.

Caveat

The SharePoint Modernization Scanner works with SharePoint Online implementations, at present. The on-premise supporting version is expected soon.

This tool and all other PnP components are open-source tools and backed by an active community providing support for them, hence there is no SLA from official Microsoft support channels.

SharePoint Modernization Scanner, is an open source tool. It works using a user interface or the command line. The generated files (output) are in comma-separated value format.

Supported features

  • Optimizing the usage of modern list and libraries
  • Connecting these sites to an Office 365 group
  • Modernizing the wiki and web part pages by creating modern site pages
  • Rebuilding classic publishing portals as modern publishing portals
  • Understanding where classic workflow is used
  • Understanding where InfoPath is being used
  • Understanding the usage of classic blog pages

As suggested in Microsoft article

The scanner will help in coming up with efforts for the features shared above. For more information about the tool refer to this Microsoft article.

It includes the images, .exe’s and other details related to the tool.

Which SharePoint site template did you use to create/provision the site?

Have you ever come across this scenario? Stop kidding, definitely you have fallen into this trap. What did you do? Let me help you here.

  1. Use PowerShell- Yes, certainly. Click here for more details.

Do you have any idea? What if the PowerShell option is not available? May be not.

Try this-
Browse any page of your SharePoint site, view the HTML source of browsed page and search for JavaScript variable “g_wsaSiteTemplateId”.

http://mundrisoft.com/tech-bytes/how-to-check-which-site-template-is-used-to-build-the-site/

You may not be able to find this variable in every site you create due to some challenge or the other e.g. Group Site or Hub Site. However, it works like a charm for others.

Enjoy.

Site Templates in SharePoint

Recently I came across a scenario when a colleague wanted to know about a site template which should be recommended to a customer to satisfy the requirements. At least, the ones which the customer believed were its requirements. So as a first step (after a brief discussion), customer was oriented towards utilizing SharePoint Online for the purpose. Then came the impending question- which site template?

Most of the modern (O365) tenants come occupied with the new admin center.

Modern Admin Center

When you try to create a new site, you get a “Group Site” created by default. This site is accessible to a group of users who are part of an Exchange group. Even if you give everyone access to this site, they still can’t access it until explicitly added to any one of the groups (owner, member or visitor).

While searching for an answer to help make the client understand (and in simple terms), I landed here. https://blogit.create.pt/fabiocarvalho/2017/02/18/sharepoint-templates-understand-the-differences/

A point to remember here, the group sites are “created” and “visible” only in the modern/new view of admin center.

Enjoy.

Microsoft Flow- Out of Box reminders

One of the promises about the upcoming features in the Office 365 business apps session during the Ignite 2018 event was about- Setting reminders in your SharePoint list using Microsoft Flow.

Some amazing individuals have tried to shed light on this topic earlier. So recently MS released this functionality to some of its SPO tenants and the MVP community was buzzing with it ever since.

Important: This feature is available only when you have a date column in your SharePoint list and the view.

You can refer to the articles shared below to gather more about how to set it up and the screen clippings would follow the textual information.

1. Chris McNulty- Sr. Product Manager at Microsoft https://techcommunity.microsoft.com/t5/Microsoft-SharePoint-Blog/It-s-time-for-reminders-in-SharePoint/ba-p/299190

2. @WonderLaura- SharePoint MVP and trainer https://wonderlaura.com/2019/01/21/flow-out-of-box-reminders/

3. SharePoint Developer Community – PnP

 

Microsoft Teams

Would you believe that Microsoft is investing huge amount of resources to make #MicrosoftTeams the next big thing.

It means, no skype for business, no emailing but improved collaboration.

If you are of the same opinion, here is a set of resources I have collected to drive the adoption in a positive manner.

https://teamworktools.azurewebsites.net/tft/index.html

http://www.buckleyplanet.com/2018/12/new-microsoft-teams-adoption-guide.html

SharePoint Saturday

Events driven by SharePoint community of (around) the local area. Speakers are selected/self-nominated and willfully share plethora of information not limited to Technological Advancements, challenges faced during any implementation and work-around. Last but not the least- Network with folks of similar interest.

SharePoint Saturday Group @Gurgaon
A typical SharePoint Saturday list of events
SharePoint Saturday – 01 December 2018 @Gurgaon. Photo courtesy- @SPSGurgaon

This type of event(s) is common in the European Countries and in the U.S. However, as India has a strong presence in the technology domain; it is time for such events to travel here and allow the technologists to showcase their knowledge and skills in the respective domain.

An awesome set of speakers joined in from locations in and around Gurgaon, some folks traveled from Bengaluru which is far from here. Few entrepreneurs and MVPs made their presence felt making the audience go weak on their knees with their command over a technology or its feature.

As SharePoint belongs to Microsoft stable, @Microsoft did play an awesome host and invited technologists to visit their office and spend a day in shoes of its employees.

I would like to give a big shout out and thank you to all the speakers, who made my day. I was able to learn about- Azure Functions, SharePoint Hub Sites (SharePoint 2016), Web Hooks, PowerApps, PowerBI, How to become an MVP?, MicrosotTeamSites, Future of SharePoint development, Azure Migrations to name a few.  Jeff Teper and Stefano Tempesta graced the occasion by  joining in through Skype.
The swags- Alexa Dot, the speaker placards stole the show for me.

Thank you all for making the day. It was wonderful and eventful. Looking forward to such events in future.

Photo courtesy: @SPSGurgaon