Academy 2 - Walkthrough – UiDemo - TryParse

Hello!!
In the Process.xaml, we are asked to make a flow decision with the method ‘Double.TryParse’. This method returns a true or false depending on whether it is possible to parse the string to double or not.

It also needs a double variable, which is used in the next flow decision to know if ‘CashIn’ is greater than 1000 or not. But the TryParse method is not giving any value to the double, having the default one, 0. So in the next flow decision, every number is lower than 1000, even the ones that aren’t.

I’ve made a Double.Parse in that flow decision in order to make it work correctly, but I don’t know id is the right solution.

Greetings,
Maria.

Hello María,

This method stores the result value in a variable that has to be passed as reference.

Variables don’t have the concept of in/out as arguments in WF. They don’t implement implicit operators so the result will never be stored as you wish.

If you need the value you can use InvokeMethod, here is an example: TEST_DOUBLE_TRYPARSE.zip (2.1 KB)

Regards,
Susana

1 Like