cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Supersan123
Helper II
Helper II

How can I use three conditions?

I have a form with two questions that I will use for a condition, "which channel" and "exhibition date". in the condition I would like to take the selected channel the date of exhibition and depending on the date would go for a specific buckte, for example: channel = Fox, date of exhibition: 08/01/2020
if fox channel and date starting with 01 buckte "within 01"
   if fox channel and date starting with 16 bucket "within 16"
      if fox channel and date other than 01 and 16 bucket "out of date"
I tried to use the switch but it didn't work because I can't have more than one case with the same answer "Fox" and if I change it and put the date it would have to be the same and I can't put it equal to 1/8/2020 because it doesn't work next month. does anyone know how to solve this problem?

1 ACCEPTED SOLUTION

Accepted Solutions

HI @Supersan123 

 

Indeed it returns a string. Your idea is correct the formula should be:

int(formatDateTime(<datefield>,'dd'))

 

For testing, I used:

int(formatDateTime(utcNow(),'dd'))

 

I've tried to simulate, and it works for me. I've attached my example as a template. You can import it and run on your side to see if it works and be able to compare what may be wrong. If you don't know how to import a template here's how to do it:

https://manueltgomes.com/microsoft/flow-how-to-import-a-flow-template/

 

I included 31 just to see if it falls today there and it's doing it correctly. 

 

Can you please check and let me know if it works.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

6 REPLIES 6
manuelstgomes
Community Champion
Community Champion

Hi @Supersan123 

 

You don't need multiple switches with Fox. One is enough. In the actions of that switch, you can fetch the day and store it in the bucket with that name since you can use a dynamic field (the calculated date) to get that.

 

Here's how to fetch the day:

formatDateTime(<your date field>,'dd')

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

 

Hi @manuelstgomes 

 

sorry if i didn't understand well because i'm not so good at power automate yet but this formula would put on the switch? because when I select my forms field below she already asks is equal to ... and I put fox because it is a field that can be chosen in formsSwitchSwitch

Hi @Supersan123 

 

That's ok. I'm here to help.

 

Below you can find an example Power Automate but here's the explanation.

  1. First, you need to filter by channel. You get into the "FOX" branch of the switch.
  2. Then you want to filter by date. Using the formula I gave you, you can get the day. Create another switch and then add conditions to the date. If it's 1, do something if it's 16, do something else and use the default for all other cases that are not the ones you want.

 

That's it. Makes sense?

 

Here is a test Power Automate. I used a manual trigger so that I could test it myself to see if it works, but the concept is the same.

Screenshot 2020-07-30 at 10.14.04.png

 

Inside create another switch:

Screenshot 2020-07-30 at 10.14.14.png

 

You're almost there! Anything you don't understand, please let me know, and I'll try to help you!

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

@manuelstgomes Thank you very much for the help you are giving me, I cannot thank you.


I understood what you told me with your images. I tried to do it now but I had some problems
when I inserted the formula and put the first case as 1 it didn't give an error when saving but when I ran a test it also didn't work and I realized that the output is 01 but when trying with 16 it presented the same error,

same wrong 01 and 16same wrong 01 and 16

 

I changed the 1 for 01 but immediately when saving this error is displayed.

when I put 01when I put 01

 

when I put the 01 I realized that it needed to be a string or int but even in the expression converting to int it didn't work

int.JPG

but not work 

HI @Supersan123 

 

Indeed it returns a string. Your idea is correct the formula should be:

int(formatDateTime(<datefield>,'dd'))

 

For testing, I used:

int(formatDateTime(utcNow(),'dd'))

 

I've tried to simulate, and it works for me. I've attached my example as a template. You can import it and run on your side to see if it works and be able to compare what may be wrong. If you don't know how to import a template here's how to do it:

https://manueltgomes.com/microsoft/flow-how-to-import-a-flow-template/

 

I included 31 just to see if it falls today there and it's doing it correctly. 

 

Can you please check and let me know if it works.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

@manuelstgomes  Thank you very much, I have no words to thank, now it worked and I learned a lot from this problem. thank you very much

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (3,368)