How to convert generic to double when generic could be a variety of types

Can you please implement it in the workflow as an example?

@ClaytonM @HareeshMR please find attached workflow revised, it is now running without exceptions however when I try to subtract after running CDbl conversion it is outputting separately the
sum of debits and credits rather than the balance.
Main.xaml (21.1 KB) project.json (759 Bytes)

Output β†’

I can’t understand why it is not netting off now after both values have been converted to double format, why is it outputting debits and credits separately?

Make sure you set all your double type variables to System.Double rather than Generic. Use .ToString when using Write Line
image

image

You see, you can use inline If condition, and you can remove the If activities above it. However, you can change the alpha values to 0 if you choose, but I think you will have problems if the value has letters or special characters since you only are catching empty values. What you have is fine though and should still work. But, let’s say a value is 1A, now that A character will cause an error. - although that might be rare. I would suggest using IsNumeric() rather than =β€œβ€

Your output looks correct, showing 2 rows where one is negative and one is positive. I would need to see your data to compare the results. Your code is telling it to do the 3rd column minus the 4th column, so if that is wrong, then you will need to adjust the calculation.

Regards.

1 Like

Thanks ClaytonM, this works.