cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gorilla_8
Post Prodigy
Post Prodigy

MAKING THE DURATION OF AN EVENT THROUGH A CHOICE COLUMN

I HAVE A CHOICE FIELD WHERE THEY HAVE:

 

- 30 MIN
- 60 MIN
- 90 MIN

 

I WOULD LIKE TO MAKE THE END DATE OF THE EVENT WITH THE SUM OF THE DATE + THE CHOSEN DURATION TIME, WOULD IT HAVE?

15 REPLIES 15
gabibalaban
Super User
Super User

@Gorilla_8 ,

You need to be more specific about your scenario. It's your datesource a Sharepoint list ? A dataverse table ? 

Are involved all items from the datasource or only a specific one ? What is the trigger of the flow ?

Gorilla_8
Post Prodigy
Post Prodigy

Oh, sorry @gabibalaban 

 

It's a Sharepoint list, just one item each time.

 

I just need to convert the value on the choice column to get the '30' or '60 or '90' and add on my 'create event v4' - endtime

@Gorilla_8 ,

It should be something like:

 

addMinutes(
    triggerBody()?['Date'],
    int(triggerBody()?['ChoiceColumn/Value']),
    'yyyy-MM-ddTHH:mm:ss'
)

 

I supposed that all values (Date -  StartDate and ChoiceColumn - i didn't get its name) are taken from the trigger. So please replace in my formula Date with your event StartDate column and ChoiceColumn with the name of the ChoiceColumn.

 

Hope it helps !  

 

Gorilla_8
Post Prodigy
Post Prodigy

@gabibalaban 

 

Thanks @gabibalaban 

 

I tried with to convert the choice column, but I got an erro with 'int'

please share the error.... and a picture of the action. 

Gorilla_8
Post Prodigy
Post Prodigy

@gabibalaban 

 

Here:

InvalidTemplate. Unable to process template language expressions in action 'Initialize_variable_2' inputs at line '1' and column '27463': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.

 

Gorilla_8_0-1634149165368.png

 

@Gorilla_8 ,

Well you didn't mention anything about " min" in your choice field. I'll supose that 60 and 90 are also with " min" at the end.

 

 

addMinutes(
    triggerBody()?['Date'],
    int(replace(triggerBody()?['ChoiceColumn/Value'],' min','')),
    'yyyy-MM-ddTHH:mm:ss'
)

 

 

 

Gorilla_8
Post Prodigy
Post Prodigy

@gabibalaban 

 

I post the 'MIN' on my post, but no problem, didn't work as expected, got an error again

Gorilla_8
Post Prodigy
Post Prodigy

@gabibalaban 

 

There is no way to convert the choice column on a int and put the value to add on date?

@Gorilla_8 ,

This is the way:

addMinutes(
    triggerBody()?['Date'],
    int(replace(triggerBody()?['ChoiceColumn/Value'],' min','')),
    'yyyy-MM-ddTHH:mm:ss'
)
Gorilla_8
Post Prodigy
Post Prodigy

gabibalaban
Super User
Super User

Can you show me the formula you use ? Are you using "min" or "MIN" in your choice column ?

Gorilla_8
Post Prodigy
Post Prodigy

@gabibalaban 

 

Here: 

 

addMinutes( outputs('Get_item')?['body/DatePicker']  ,    int(replace(outputs('Get_item')?['body/Duration/Value'],' min','')),   'yyyy-MM-ddTHH:mm:ss')

Sorry, I surrely miss something. So the choice values are: 30 min, 60 min, 90 min. Is there any other character? 

Gorilla_8
Post Prodigy
Post Prodigy

@gabibalaban 

 

Yes, the choice column have those options: 

 

30 min
60 min
90 min

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Users online (1,921)