cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Cfis
Helper I
Helper I

Skipping Blanks

Hi All,

 

Currently building a flow for contract automation and have the majority complete aside from a specific field for a review date.

 

Some contracts won't have a review date and others will.

Previously had issues with the date format on the "Start Date" so used the below: -

 

Compose_1:

int(item()?['User - User orig_x002e_ hire date'])
 
Compose:
addDays('1899-12-30',outputs('Compose_1'),'dd-MM-yyyy')
 
This works perfectly from testing.  I tried to adapt this to the review date, but as soon as it hits a blank the flow errors.  Current code is: 
 
Compose_2:
int(item()?['Offer letter - Fixed Term Review Date'])
 
Compose_3:
addDays('1899-12-30',outputs('Compose_2'),'dd-MM-yyyy')
 
Any suggestions on how to get it to ignore the blanks if there is a blank on that line?
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Cfis ,

Could you please show me a screenshot of the configuration parameters in your populate a Microsoft word template?

Please check that we need to put the output of compose 3 into the Fixed Term Contract Review Date parameter instead of the output of Compose 2.

There is no problem with compose 2 outputting numbers. These numbers represent the number of days between December 31, 1899 and the date returned in your Excel table.

Best Regards,

Sunshine Gu

View solution in original post

23 REPLIES 23
v-yetonggu-msft
Community Support
Community Support

Hi ,

Please try put this expression in Compose1 and Compose 2:

if(empty(item()?['User - User orig_x002e_ hire date']),0,int(item()?['User - User orig_x002e_ hire date']))

if(empty(item()?['Offer letter - Fixed Term Review Date']),0,int(item()?['Offer letter - Fixed Term Review Date']))

Best Regards,

Sunshine Gu

Hi,

 

So, the Hire Date field is not the issue as that works.  I've taken the below into Compose_2:

 

if(empty(item()?['Offer letter - Fixed Term Review Date']),0,int(item()?['Offer letter - Fixed Term Review Date']))

This works so thank you! However now when it's blank the date of 30-12-1899 is input because it's now pulling from Compose_3:

addDays('1899-12-30',outputs('Compose_2'),'dd-MM-yyyy')
 
Some background on this, was struggling originally with the date's inputting onto the word template in the correct format of dd-MM-yyyy and this solution worked.  Presumably in this edge case where there is a blank, it won't work and will need additional refinement?

I've just tried removing Compose_3 to see the output and in a field that has no review date the output is "0" and in a field that has a date gives me the issue i had before on the start date "45625"

Hi @Cfis ,

What do you want to know?

 

Best Regards,

Sunshine Gu

Well the first part worked but the issue now is that if there is no date in the review date field it puts a date of 30-12-1899 instead of leaving it empty because of the next section of formulas to adapt the numbers into a date field:

 

addDays('1899-12-30',outputs('Compose_2'),'dd-MM-yyyy')

Hi @Cfis ,

Please try this expression in Compose 3:

if(equals(addDays('1899-12-30',outputs('Compose_2'),'dd-MM-yyyy'),'30-12-1899'),null,addDays('1899-12-30',outputs('Compose_2'),'dd-MM-yyyy'))

Best Regards,

Sunshine Gu

Thanks, tried that but now getting the below error:

 

InvalidTemplate

Unable to process template language expressions in action 'Compose_3' inputs at line '0' and column '0': 'The template language function 'addDays' expects its second parameter to be an integer. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#adddays for usage details.

Hi @Cfis ,

Please use this formula in Compose 2:

if(empty(item()?['Offer letter - Fixed Term Review Date']),0,int(item()?['Offer letter - Fixed Term Review Date']))

Best Regards,

Sunshine Gu

Cfis
Helper I
Helper I

Thanks.  This doesn't error now but if the field contains a date. it's now inputting as "45625" instead of an actual date (in this case it should be 29-11-2024)  This was what the original Compose_3's code corrected

Hi @Cfis ,

OK,I've found that you always like to change the correct formula according to your ideas, which leads to mistakes, and I have to correct them back and forth, which leads to problems that are not solved for a long time, and I want you to put aside your thoughts for a while and ask you to use this formula in Compose 3 again:

if(equals(addDays('1899-12-30',outputs('Compose_2'),'dd-MM-yyyy'),'30-12-1899'),null,addDays('1899-12-30',outputs('Compose_2'),'dd-MM-yyyy'))

Best Regards,

Sunshine Gu

Erm, bit rude.  Compose_3 has the exact string that you previously sent over and i've not changed it at all yet it results in the issue mentioned above.

Hi @Cfis ,

How about this?

Could you please send me a screenshot of your flow?

I want to know what formulas you used in Compose 2 and Compose 3 respectively, and whether you used the list rows present in a table control?

Thanks.

Best Regards,

Sunshine Gu

Cfis
Helper I
Helper I

Cfis_0-1719910696508.png

Compose_1 and Compose are for the start date field which work perfectly.

Compose_2 and Compose_3 are the problematic ones for the review date

Hi @Cfis ,

Please try this expression in Compose 2:

if(empty(item()?['Offer letter - Fixed Term Review Date']),0,int(item()?['Offer letter - Fixed Term Review Date']))

And please try this expression in Compose 3:

if(equals(addDays('1899-12-30',outputs('Compose_2'),'dd-MM-yyyy'),'30-12-1899'),null,addDays('1899-12-30',outputs('Compose_2'),'dd-MM-yyyy'))

And I did a test for your reference.

In my scenario:
My Excel Table:

vyetonggumsft_2-1719911605033.png

Flow Run History:

vyetonggumsft_0-1719911500338.png

Flow Configuration:

vyetonggumsft_1-1719911574294.png

Best Regards,

Sunshine Gu

Same issue, example output on one that has no date in the review field works fine:

Cfis_0-1719911978883.png

 

Example of one with a date in the review field:

Cfis_1-1719912002795.png

 

Hi @Cfis ,

Could you please show me your formula in Compose 3?

Many thanks.

 

Best Regards,

Sunshine Gu

Cfis
Helper I
Helper I

Yup, it's the code you sent:

 

Cfis_0-1719912491628.png

 

Hi @Cfis ,

The 'Offer letter - Fixed Term Review Date' column in your excel table needs to be formatted:

vyetonggumsft_1-1719913760821.png

vyetonggumsft_2-1719913802468.png

And please try these two expressions in Compose2 and Compose3 respectively.

Compose_2:
if(empty(item()?['Offer letter - Fixed Term Review Date']),0,int(item()?['Offer letter - Fixed Term Review Date']))
Compose_3:
if(equals(outputs('Compose_2'),0),null,addDays('1899-12-30',outputs('Compose_2'),'dd-MM-yyyy'))

Best Regards,

Sunshine Gu

Cfis
Helper I
Helper I

The excel sheet cannot be changed as the process needs to be automated with minimal touch points and is based on a system output into Excel.  The field is currently formatted as a short date but still causes the issue.

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (546)