cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

If condition for amount of numbers

Hello. Wondering if anybody can help with this. I have created a BOT, but I am struggling with an IF condition. I have created the bot on the non coding side. I basically want the BOT to give two different responses to what a user inputs. The user will be asked to confirm a number. If this number is 5 characters or above, the user will be advised one thing and if the user inputs a number using 4 characters or below, they will be advised another scenario by the BOT. Just cant seem to be able to set a condition for this, only giving me the option to set a word as a condition.

 

 

Would appreciate if somebody could provide some feedback on how to do this 😀

29 REPLIES 29
Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @Anonymous,

 

Can you share a screenshot of your test conversation/chat with your current PVA bot? This way I can see with which numbers you are testing 😀

 

I also need to update the flow logic. I now see your requirement is 4 characters or less. So, we probably need to add a lessOrEquals function to our length expression.



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @Anonymous,

 

I have changed the setup slightly. Can you have a look and try if the setup below works for you?

 

1. In the compose action I am using a updated expression.

if(lessorequals(length(triggerBody()['text']), 4), 'Organisation A', if(equals(length(triggerBody()['text']), 5), 'Organisation B', '6 characters or more'))

 

In that expression I am checking if the length is less or equal to 4. If this is true I am outputting Organisation A. When false I am checking if the length equals 5. If that is true I am outputting Organisation B. For a length that is higher than 5 I am outputting the text '6 characters or more'.

 

lessorequals4.png

 

2. In the topic I have updated the conditions. Instead of checking for a number we can now check for the name of the Organisation. 

 

 

counttopic_v2.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Anonymous
Not applicable

Hi Dennis.

 

 

I have updated it to exactly how you have it apart from making changes to text I want to apply - 

if(lessorequals(length(triggerBody()['text']), 4), 'This appears to be an Emis CDB Org code supported by Emis help. Please contact them directly for more assistance with this one', if(equals(length(triggerBody()['text']), 5), 'This looks like one of our community codes''6 characters or more'))
 
So, that is basically saying that if they type something in with 5 characteres, it will advise them its a code supported by community. Then, if they type in a 4 character one, it says contact Emis. However, please see below screen shot of it just going to the other condition on the right hand side no matter what I put in (I cant delete this condition either, it doesnt let me!!!):-
 
 
Unwanted Condition Being selected.PNG
I feel I am so close to what I want here largely thanks to your help. Just hope this makes sense of what I want, just not sure why that 'All other conditions' one is there and why that one is being selected, even though I am putting in a code with 5 characters in, why should go to the message '
This looks like one of our community codes'
 
Thanks again for this Dennis as I said, hopefully you can see what I mean and how to prevent it from going to the other condition, even though it should be going to the condition on the left that is equal to 5.
 
 
Kieran😀
Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @Anonymous,

 

You are very close. I see you are still using the numbers in the condition actions. What you are outputting in the expression in the flow needs to match what you are checking in the pva condition action.

 

Below is a screenshot, hope this makes sense?

 

theseneedtomatch.png

 

You can use whatever you want in your expression in flow and the condition in your topic. As long as those values match. See also in my example below.

 

thesematch_example.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Anonymous
Not applicable

Hi Dennis. Thank you for that, I have fixed that and the expression in the condition matches the expression from the flow. However, please see below, I am inputting a 5 digit number and its still going to the unwanted condition on the right hand side, not the one on the left:-

 

Unwanted Condition Being selected.PNG

Not sure why its doing it, as the expression seems to be correct in terms of what it is to state when a 5 digit number is put in (Should go to the left hand condition stating that it is a supported community code. Sorry if this is becoming a pain and I am still doing something wrong, but not sure how it can be wrong when all what you have suggested is now in place. The expression I have is:-

 

 

if(lessorequals(length(triggerBody()['text']), 4), 'This appears to be an Emis CDB Org code support by Emis Web. Please contact them directly.', if(equals(length(triggerBody()['text']), 5), 'This looks like one of our community codes''6 characters or more'))
 
Again appreciate your support so far with this, its got me much further than I thought I would be at this stage, just hoping its one last little thing now that retifies this! 😀

 

Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @Anonymous,

 

I would keep it a bit simpler by replacing 'Go to CharacterCount' by just the text you want to show. I would also just use the numbers instead of the long text in both the flow expression and the condition action. This also makes it a bit more managable.

 

Can you try the setup below?

 

Flow expression:

if(lessorequals(length(triggerBody()['text']), 4), '4', if(equals(length(triggerBody()['text']), 5), '5', '6 characters or more'))

 

flowexpression.png

 

Topic canvas:

 

hardcodetext_pva.png

 

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Anonymous
Not applicable

Hi @Expiscornovus 

 

 

Thank you for that, I have ammended that and have changed the expression to what you have said and updated the fields on the canvas. However, it was still going to the other condition on the right even though I met the crietia. So, I removed this condition and now it just gets stuck:-

 

Result.PNGInput.PNG

I have also inserted the flow chart details to see if I am doing something wrong? I tihnk all what you have said is now in there, just not sure why its still not recognising the condition is being met and giving the correct message response.

 

 

Thanks again Dennis, hopefully you spot the error and it can be sorted, appreciate your help I know I have mentioned this a LOT already 🙂

 

 

Kieran

Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @Anonymous,

 

It looks like there is a space character just before the fx button in the compose action. If there is a space character in that compose action, can you remove that?

 

And I also have some additional questions for troubleshooting.

 

1. What is the trigger phrase for your topic?

In my example that is CountNumbers. That is the first thing I will type to make sure the bot knows which topic I want to interact with. I can't see that in your test screenshots. Are you typing the trigger phrase first before you enter the number?

 

countnumbers_triggerprhase.png

 

2. Can you add another compose action and add the inputnumber field to it?

Via peek code we can check if the internal name of your field is the same as in the expression we are using. Potentially it could be different and that can be a root cause for your wrong CharacterCount output.

 

secondcompose.pngpeekcode_text.pngpeekcode_textfield.png

3. Can you peek code the current compose action?

Like mentioned earlier in this post. It looks like there is a space character just before the expression.

 

othercompose_peekcode.png

 

4. Can you have a look at the history of the flows?

In the history it is also easy to spot what the system is trying to process.

 

flowhistory_check.png

 

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Anonymous
Not applicable

Hi Dennis.

 

 

So sorry, I have rectified that now and added in the new compose. My trigger phrase is going to be numbers that we support, as it will be users asking questions in relation to that. See below:-

 

Snap1.PNG

So, above has 5 codes for now for testing purposes and this error is happening even though I am putting one of the 5 digit codes in, which is where it then asks me. I am going to have all codes there for community and for the 4 digit ones supported by Emis Web (if this makes sense?) so as long as thats being met, it will ask if the user is wanting to discuss an Emis CDB ORG code.

 

Below, is the new look of the compose with the additional one you have mentioned:-

 

snap2.PNGSnap1.PNG

The screen shots are the opposite way around there sorry, but hope it shows the full flow chat, as well as my expression which you provided. Do you think in theory this should now work if I am especially putting in trigger phrases (but it should work regardless with the 5 or 4 characters being entered with the Character Count being met). Sorry if I have waffled on there, hope I make sense.

 

 

Thanks Dennis, look forward to hearing back 😀

 

Kieran

Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @Anonymous,

 

If the trigger phrase is the same as the actually code this might confuse the bot. When you retype the code in response to 'Can you please reconfirm the Org code' question the bot might start over again and will ask the first question again. 

 

Typically a trigger phrase is something a user enters in the chat window to start a conversation with the bot. I would use something random like 'I need help with Emis CDB' or even just one word like 'Emis'.



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Helpful resources

Announcements

Check out the Copilot Studio Cookbook today!

We are excited to announce our new Copilot Cookbook Gallery in the Copilot Studio Community. We can't wait for you to share your expertise and your experience!    Join us for an amazing opportunity where you'll be one of the first to contribute to the Copilot Cookbook—your ultimate guide to mastering Microsoft Copilot. Whether you're seeking inspiration or grappling with a challenge while crafting apps, you probably already know that Copilot Cookbook is your reliable assistant, offering a wealth of tips and tricks at your fingertips--and we want you to add your expertise. What can you "cook" up?   Click this link to get started: https://aka.ms/CS_Copilot_Cookbook_Gallery   Don't miss out on this exclusive opportunity to be one of the first in the Community to share your app creation journey with Copilot. We'll be announcing a Cookbook Challenge very soon and want to make sure you one of the first "cooks" in the kitchen.   😊Don't miss your moment--start submitting in the Copilot Cookbook Gallery today!     Thank you,  Engagement Team

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!      

Welcome to the Copilot Studio Community!

You are now a part of a vibrant growing group of peers and industry experts who are here to network, share knowledge, and even have a little fun!   If you have not yet registered, please visit here to learn how to register!   Now that you are a member, you can enjoy the following resources:   The Microsoft Copilot Studio Community Forums If you are looking for support with any part of Microsoft Copilot Studio, our forums are the place to go. They are titled "Forums" and there you will find technical professionals with years of experience who are ready and eager to answer your questions. You now have the ability to post, reply and give "kudos" on the Copilot Studio Community forums! Make sure you conduct a quick search before creating a new post because your question may have already been asked and answered!   Microsoft Copilot Studio Ideas Do you have an idea to improve the Microsoft Copilot Studio experience, or a feature request for future product updates? Then the "Copilot Studio Ideas" section is where you can contribute your suggestions and vote for ideas posted by other Community members. We constantly look to the most voted Ideas when planning updates, so your suggestions and votes will always make a difference.   News & Announcements The Copilot Studio Community News & Announcements is your stop to get all the latest news around Community events and announcements. This is where we share with the Community what is going on and how to participate!   Copilot Studio Samples, Learning and Video Galleries We have galleries that can assist you with information on creating a bot in our Webinars and Video Gallery,  and the ability to share the bots you have created in our Bot Sharing Gallery.  Check out the awesome content being shared there today!   Again, we are excited to welcome you to the Microsoft Copilot Studio Community family! Whether you are brand new to the world of bot creation or you are a seasoned Copilot Studio veteran, our goal is to shape the Community to be your ‘go to’ for support, networking, education, inspiration and encouragement as we enjoy this adventure together!   Let us know in the Community Feedback if you have any questions or comments about your Community experience. To learn more about the Community and your account be sure to visit our Community Support Area boards to learn more!   We look forward to seeing you in the Copilot Studio Community!The Copilot Studio Community Team

Tuesday Tip | How to Report Spam in Our Community

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: How to Report Spam in Our Community We strive to maintain a professional and helpful community, and part of that effort involves keeping our platform free of spam. If you encounter a post that you believe is spam, please follow these steps to report it: Locate the Post: Find the post in question within the community.Kebab Menu: Click on the "Kebab" menu | 3 Dots, on the top right of the post.Report Inappropriate Content: Select "Report Inappropriate Content" from the menu.Submit Report: Fill out any necessary details on the form and submit your report.   Our community team will review the report and take appropriate action to ensure our community remains a valuable resource for everyone.   Thank you for helping us keep the community clean and useful!

The Copilot Studio community is thrilled to share some exciting news!

We are 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 that our community advocates for.  We're proud to announce that the Copilot Studio community will pioneer this migration starting in June 2024. The move will mark the beginning of a new chapter, and we're eager for you to be a part of it. Following our lead, the rest of the Power Platform product sites will join us over the 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, to 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 (4,816)