cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SeanHenderson
Impactful Individual
Impactful Individual

Fill Out Months for the Rest of the Year Based on Today's Date

Hi,

I have a requirement that I can't think of a good way to build, so I thought I'd throw it out there and see if anyone has any ideas.

I have an entity in CDS for a model driven app that does expenditure phasing by month from January to December, then Carryover. This shows up as a sub-grid on the form for an expense:

Annotation 2020-09-14 152053.png

 

That pic is a mock up, it doesn't have to look exactly like that. But the idea is basically the same, a month, then the amount for that month.

I want a Flow to auto-populate this grid on creation of a new expense entry, with all zeroes. Which is easy enough on its own. But here's the tough part: I want the Flow to check what month we're currently in and only create entries for the current month and the rest of the year. So if someone creates an expense in October, then the grid will have 4 entries: October, November, December and Carryover.

Ideally I'd like the value for the year to be in there too. I think there might be a way to do it by extracting the value for today's date, but I can't figure out how.

 

Anyone able to solve this puzzle?

 

Thanks

2 REPLIES 2
vikulkar
Community Support
Community Support

Hello @SeanHenderson ,

Here's an approach that you can think of:

You can get the current month by using the formula: 

substring(formatDateTime(utcNow(),'MM-dd-yyyy'),0,2)
You can then use the output of this and subtract it from 12 which will give the remaining months:
sub(12,int(outputs('Compose'))).
After this you can have a do-until loop and within the loop you can compare the month and update the necessary records within it.

 

FlowCal.PNG

 

If you liked my response, please consider giving it a thumbs up.

and if it solved the issue, please accept it as a solution

 

Thanks and Regards,

     Vikas K

 

 

SeanHenderson
Impactful Individual
Impactful Individual

@vikulkar 

This is a good start. It will create the correct number of records, for example, if I run it now it creates records for September through December. I had to change the condition to check if the variable is "Greater than" rather than "Less than or equal to" the way you had it.

However, it doesn't increment the month, it just creates 4 records for September:

Screenshot 2020-09-16 153236.png

I need it, with each increment, to increase the number as well. It should also say the name of the month rather than a number, or at least an abbreviation like Sept. And after Dec, there needs to be a final entry called "Carry" to represent what the next year carryover will be.

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (1,786)