Posts

Regular Expressions within Power Automate

Image
Out of the box, Power Apps supports Regular Expression (or RegEx) matching through in-built IsMatch, Match and MatchAll functions . However to use Regular Expression within Power Automate, we need to use an Independent Connector - RegEx Matching . There are eight (8) actions supported within this connector. While seven are specific to common use cases, there is a generic action which can cover any RegEx needs. In this blog post we will look example for three actions within this connector Check for valid email format This action checks whether entered text is in a valid email format Check whether text contains digit This action checks whether entered text contains a digit anywhere Check whether text matches the specified pattern This action checks whether entered text matches the specified pattern. This is a  generic action which can cover any RegEx use case.

Date and Time Formatting in Power App

Image
Under this blog, we will learn how to show a date and time value in various formats using Power Apps. For this post, we will use Today() function to get the Date and Now() function to get the Date and Time. However, you can replace this with SelectedDate from the DatePicker control, or you can also use  DateValue()  or  DateTimeValue()  function to generate a Date (or DateTime). We have previously looked into how to get first date of a month and last date of a month. First, we add two labels, one for  Today()  and another for  Now() To format the date, we use the Text() function and specify the format that we want. For example, if we use Text(Today(), LongDate) , then it will give as below: In the same manner, the other most commonly used formatting options available are:

Increase number of rows returned from Get Items SharePoint Action under Power Automate

Image
By default, SharePoint Get Items action only returns 100 items which matches your Filter Query.  You must always try to use ODATA filter query to reduce the number of rows that are being returned to you. This will make your cloud Flows much for efficient. If you have a large SharePoint List and your use-case requires, getting more than 100 items, then you will need to make a small setting change to the Get Items action  in your Flow. You will have to do this change each time you add a Get Items action requiring more than 100 items. 1 - If your requirement is upto 5000 records In this scenario, you can change the Top count property to 5000. 2 - If your requirement is upto 100,000 records Under this scenario, click the 3-dots ellipses next to the Get Items action and turn on the pagination settings with Threshold equal to or less than 100,000 depending on your use-case. Note that your license type may restrict the maximum number your can use in the Threshold settings. All license types a

Generate QR code within Power Automate

Image
In this post we will learn how to dynamically generate QR code using Power Automate and then send that as a PDF attachment to an email address. For this post we will use Google Charts API, however note that since this is an external API so you need to check with your organizational data loss prevention policies, data security policies before making any API calls. Additionally, since this is a third-party API, this may be discontinued in the future and hence you may want to plan for this. The URL to generate a QR code looks as below: https://chart.googleapis.com/chart?cht=qr&chs= 300x300 &chl= powerplatformguide.blogspot.com Here we dynamically specify the dimensions of the QR code and its content based on our requirement. To build such a Flow, we will follow the following steps: 1 - Create an Instant Flow with three user input parameters as below: 2 - Add an action using OneDrive connector to upload a file from URL with parameters as seen below. We need to make sure that the de

Restrict Attachment control in PowerApps to accept Excel files only

Image
In one of the previous posts, we learnt how we can create a notification from Power Automate when a certain file-type is uploaded to a SharePoint Document Library. In this post, we will learn how we can restrict Power Apps attachment control to accept only a certain file-type. We will use Excel file (.xlsx) as the accepted file-type, however this can be similarly customized to any file-type(s). In the Attachment control, go the property  OnAddFile  and enter the following code: UpdateContext(     {         validFileType: EndsWith(             Lower(Last( AttachmentControl .Attachments).Name),             "xlsx"         )     } ) Now, the context variable that we have created, i.e.  validFileType  can be used to provide error message to the user, such as disabling the submit button or if using in-built Form, then putting in the errorMessage datacard. Updating error message datacard: Coalesce(     Parent.Error,     If(         !IsBlank(DataCardValue4.Attachments) && !va

Get start and last date of month using Power Apps

Image
In a previous post, we looked at how to get first date and last date of a month using expressions in Power Automate.  In this post, we are going to look at how we can get the same information in Power Apps. Here, we have used Today() to get the dates based on current date, however it can be made even more dynamic by using DatePicker and replacing Today() with DatePicker1.SelectedDate All dates calculated in this post are in the US format: MM-DD-YYYY First Day of Month DateValue(Month(Today()) & "/" & "1" & "/" & Year(Today())) First Day of Next Month In this step, we add 1 month to the first day of the current month DateAdd(     DateValue (Month(Today()) & "/" & "1" & "/" & Year(Today())),     1,     Months ) Last Day of Month In this step, we subtract 1 day from the first day of the next month DateAdd(     DateAdd(         DateValue (Month(Today()) & "/" & "1" &a

Get start date of month and last date of month dynamically from Power Automate

Image
There can be multiple business use cases where you want to know start date and end date of the month in a dynamic manner, either where a date is provided to you, or you are using current date. For example, if you want to filter your data-source to show records for an entire month. This can be achieved using expressions within Power Automate. In this post, we are using current date/time to obtain first and last date of the month. Start date of the month startOfMonth(utcNow(),'yyyy-MM-dd') Last date of the month There is no in-built function to calculate last day of month, so we will first calculate first day of the next month and then subtract 1 day from it. First date of next month : startOfMonth(addToTime(utcNow(),1,'month'),'yyyy-MM-dd') Last date of current month: addDays(startOfMonth(addToTime(utcNow(),1,'month')),-1,'yyyy-MM-dd')