Double.TryParse is always returning 0 in the output variable

Hi,
I am currently working on the framework demo application and I am facing the below issue.
Double.TryParse(CashIn, dbl_CashIn) provides me the correct output i.e. true/ false but it does not update the dbl_CashIn variable and always return 0. I don’t know why byref is not working.

Hi,
The out parameter can not be specified in the assign activity.
In this case we will use the Invoke method.

3 Likes

Hi,
I did the above because it was passing the if condition i.e. all the values are double but as the dbl_CashIn was always 0 the second condition was always true i.e. less then 100

hi, ashish
In the assign activity, the value of dbl_CashIn variable is not set in the TryParse method,
so the initial value of 0.0 is applied.
Therefore, it seems that the second condition is always determined to be true.

Hi Kawata,

I have added a new sequence activity to convert the value to double using invoke method as you suggested and now its working.
I think this step should be added to the framework walkthrough pdf document.
Another issue which I found out is that application which was provide by uipath does not allow decimal i.e. dot to be inserted inside the textboxes and due to which incorrect values are getting inserted.
Thank you for you earlier reply.

3 Likes

Hi ashish, can you share the invoke code that you have used here, thanks.

hey ashish can you help with this code

Hi @armamidwar, please find it below:

where “parsed” is the Result of InvokeMethod Activity

Screenshot along with Properties window and Input/output arguments.

4 Likes

Why would we need a Invoke method activity? Can we assign dbl_CashIn with Convert.ToDouble and use the variable? Any drawbacks in doing so??

2 Likes

Hi @haravallabhan

This should work without an issue. There are always multiple approaches :slight_smile:

1 Like

Hi Guys I am not from Java or VB background hence do not know what does “Double.TryParse” do? I faced the same issue using double try parse and hence used invoke method as suggested in the above messages, even then i am able to get the converted dbl variables for CashIn and OnUsCheck but it doesnt convert the “NotOnUsCheck” …what could be the issue can someone help.

So basically i am seeking for two answeres -

  1. what does double try parse do exactly
  2. why NotOnUsCheck is not converted to double

Thanks.

Similar to @haravallabhan 's question, how does one tell when you need to use invokeMethod for something e.g. would it be …
it is ok to get the boolean result from TryParse without invokeMethod as that is the output of the function, but if the function has a variable as an argument, you must always use invokeMethod if you want the result to be put in that variable? (is it that simple, hopefully :blush:?)