pasimon
(Pau Simon)
October 31, 2019, 2:22am
1
Hello Everyone,
I am trying to make an automation where in I will make the user to input words into a Input Dialog Box, then output the result to a message dialog box. But also I wanted to put certain catches when ever the user puts null on the input box or even close the box itself.
I have tried putting try-catch but doesnt catch any exception, it just go directly to the “finally” block.
Please see attached XAML. Main.xaml (8.5 KB)
I really want to learn about this.
Thank you.
1 Like
Jumbo
(Jumbo Suzuki)
October 31, 2019, 2:44am
2
@pasimon
it is because the message box is working properly, you need throw if you want do that.
Please refer my xaml and try-catch description.
Main.xaml (11.4 KB)
Rgds,
J,
2 Likes
pasimon
(Pau Simon)
October 31, 2019, 7:01am
3
Hi,
I have tried this. Thank you very much. But how about for example the user didn’t put any values again? How can automation throw another catch block?
Jumbo
(Jumbo Suzuki)
October 31, 2019, 7:35am
4
Hi,
Actually, I’m not quite sure what you would like to do. If you would like to ask user to enter the value if that is blank, then you need to use flowchart and flow decision instead of Try-catch… If something wrong, plz let me know what you want to do.
System.Activities.Statements.FlowDecision An activity which executes one of two branches, depending on whether a specified condition is met. The branches are entitled True and False by default, but their names can be changed in the Properties panel....
lakshman
(Ganta lakshman)
October 31, 2019, 7:39am
5
@pasimon
Create one output variable of type string for Input dialogue box activity and say ‘readInput’
You can check Null values like this.
String.IsNullOrEmpty(readInput)
And also you can check length of it.
readInput.Trim.Length > 0
Then they entered input
Else they entered null value.
1 Like
pasimon
(Pau Simon)
October 31, 2019, 7:44am
6
Hi, @Jumbo .
For example…
Try
First Input > User entered null > Throw to catch block
Catch
Second Input > “Accidentally” user entered null again (it must be throwed again to a catch block)
Apologies if I can’t explain it that well.
pasimon
(Pau Simon)
October 31, 2019, 7:45am
7
@lakshman
Already got it, thank you for this.
1 Like
Jumbo
(Jumbo Suzuki)
October 31, 2019, 8:18am
8
Please once check this, I changed your logic and I assume this is what you want to do, isn’t it?
flow.xaml (13.2 KB)
Actually, I don’t understand why it is try-catch…
1 Like
pasimon
(Pau Simon)
October 31, 2019, 9:11am
9
Hi @Jumbo ,
Thank you so much for this, my mind was stuck only in using sequence thats why. This is a great help.
Thank you!
system
(system)
Closed
November 3, 2019, 9:11am
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.