cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RaoulDobal
Frequent Visitor

Adddays to add intervall to a sharepoint task list with variable days

I have a sharepoint task list that when a task is completed, creates a new element with a specific amount of days in the future. These days are defined by an intervall each task element has (yearly, monthly etc., defined in a dropdown list named 'intervaldescriptor')
I think having a multitude of if/then clauses is not really elegant, so I looked to "dynamically" use the add days function.
addDays(triggerBody()?['StartDate'],triggerBody()?['Interval'])
 
I tried two things:
  1. Interval: calculated column (if intervaldescriptor=Year, 365, if intervaldescriptor=Month etc. That did not work.
  2. so I tried the easy version of just adding the number of days in the field
    Interval: number field
But the workflow has problems with the ...triggerBody()?['Interval']. If I just put a number there, it works fine.
Any ideas how to achive this?
 
Thank you for your time
Raoul 
3 REPLIES 3
Community Support
Community Support

Re: Adddays to add intervall to a sharepoint task list with variable days

Hi @RaoulDobal,

 

Is the column Intervaldescriptor of type choice? What selections are contained in the dropdown?

It seems that each task has yearly, monthly etc. defined in the dropdown list, how is it configured?

I assume that without using calculated column, you could try to use if function to return the corresponding value based on the selection. Then use the return number in the adddays function.

Please share more details on your scenario for better understanding.

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
RaoulDobal
Frequent Visitor

Re: Adddays to add intervall to a sharepoint task list with variable days

They are configured as a dropdown with (yearly, quarterly and monthly). From that I had a calculated field defined, giving me the days - if monthly>30.

 

I will have to look into the if function in flow - have not used this yet although it should have been obvious. Newbie to flow. I will post the results. 

RaoulDobal
Frequent Visitor

Re: Adddays to add intervall to a sharepoint task list with variable days

Ok, a small step forward

 

I tried (among many other permutations)

if(equals(triggerBody()?['Intervall'],'Jahr'),'365','1')

 

The flow runs through, but it always gives me false (feedback 1)

 

The goal is - If it would find the Sting 'Jahr" in the dropdown generated sharepoint list field [Intervall], it would output 365, otherwise it would output 1. Of course I would then replace 1 with another IF statement for "months" and so forth.

 

But it doesn't

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (7,900)