can you help me with double variables? When my variable is 0 it throws error. However, I do a sum of two variables to check if the total is correct. So when one of them is zero I have to do try catch but still I dont know which one of them is 0.

My variables are amounts lets say from invoice. There can be plenty of them. ANd I have one row of invoice in one row of DT. So I go through rows and read the amounts if some conditions are met. Then I get for example 22.98, 33.44 etc. which must be double if I wanna do a sum, right? But when you do not fill anything into the DT it throws error when I do the sum which you can see above. Moreover, it is not possible to set the default value in the DT to be zero.

In the end I do this for three types of amounts. One which is taken into account, one which is not and special type. ON the invoice I have just total so I need to check the total sum of them.
Convert.ToDouble(DT1.Compute(“sum([amounts])”,“”)) + Convert.ToDouble(DT2.compuute(“sum([amounts])”,“”)) + Convert.ToDouble(DT3.Compute(“sum([amounts])”,“”)) cannot be in try catch because I dont know which of them is the null DT.

TO be more precise I have it as a condition in IF activity that total=sumofDT1+sumofDT2…

The only solution I found so far is put if activity into try catch. Excepiton is another try catch with the same if but without one of the Sum of DT. In it is another excepitoon withou the amount from previous excepiton and the one which was omitted was added. I am looking for more elegant solution

I believe if you use an Excel Scope with Write Cell or Write Range, Excel handles the formatting. So, if you send a date or number in as a string Excel still automatically formats it by default. However, I could be wrong though.