Convert DT Row Item to Negative Value

Hello,

I could use some help converting a positive value to a negative number.

This is part of a workflow that reads an excel sheet then loops through the data to make various changes. One update I need is for the amount in Column2 converted to a negative number.
Within my for each row activity I believe I will need to use an assign activity, just not sure what I need to wrap around my Row.Item(“Column2”) in order to make the value negative.

Hi,

If your value is integer, the following will work.

Row.Item("Column2") = CInt(Row.Item("Column2").toString())*(-1)

If your value is double, can you try the following?

Row.Item("Column2")  = Cdbl(Row.Item("Column2").toString())*(-1)

Regards,

1 Like

Awesome, thank you. My value was a decimal so I changed it to Cdec and it worked perfectly. :slight_smile:

2 Likes

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