Foundation Lesson2 Practice2

Hi,

Getting the error below where variable C is an integer and variable A is a string:

The workflow has validation errors. Review and resolve them first.

Compiler error(s) encountered processing expression “C + A”.
Option Strict On disallows implicit conversions from ‘String’ to ‘Double’.

Please help!

Hi @mrityusingh

You get the error because the variables are in two different data types.
You have two options. You can either convert the string value to number format, or you can convert the number value to string.

Depends on what you want to get as the output. If both are in string, it will not add the values, but it will concat them.
If both are in integer, it will add the values…
Try these two…
String to integer
Int32.Parse(StringVariable)
Converts string value to integter

integer to string
intVariable.ToString

Applying to your expression

  1. Ex: C = 1, A = “2”
    C + Int32.Parse(A) result is: 3
  2. C.ToString + A result is: 12

Does it help?

Thanks @ Lahiru.Fernando

Wanted to add that there is easier way of getting by this error - change the variable type to generic from string/int32.

1 Like

Hi…
Thanks for sharing… and yeah, generic type variable also works fine when handing multiple data types

I mainly wanted to explain how the output will be in handling two data types… different ways of handling stuff :slight_smile:

In generic it will be automatically done for you…

Thanks again for sharing awesome findings as well… :slight_smile:

Thanks again…

Just another basic question … how do I copy the error comments from studio… I managed to do it on this one but unable to recall how I managed to do it…

There is a shortcut but unable to recall it

Double clicking on the message usually opens it in another window where you can copy the message… did that work?

Tried that already… but didn’t work!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.