Subscribe
Accepted Solution

Doing Concatenation and not addition

I am using cDOT Resize volume command to resize a volume by specifying a increment size and not the absolute size.

resizeVolume is my Command Variable.

In the other parameters tab, for attribute TargetSize I am having an expression as follows

resizeVolume.size_mb+$IncrementSizeInGB*1024

 

 

The above expresion is getting evalueated as string and getting concatenated and not added as integers.

 

So if my resizeVolume.size_mb is 1024 which is 1GB and my $IncrementSizeInGB is 50GB then the result I get in the execution plan is 

102451200 which is (1024+50*1024) 102551200

 

Am I missing something ? How to get this as addition and not concatenation

 

Regards

adai

Re: Doing Concatenation and not addition

Here is an example of resize function ( check for the (int) when returning a result so it does not concatenate as a string ) :

 

def setNewVolSize(growVolume, addSize, rateOfChange) {
  if (addSize=='')
     return growVolume.size_mb;
  else
     return ((int) growVolume.size_mb) + calculateVolumeSizeFromDataSize(convertFromGB(addSize),rateOfChange);
}

Re: Doing Concatenation and not addition

[ Edited ]

Adai, I am checking to see if this is a bug. In the meanwhile you can use this expression to make sure the numbers get added instead of concatenated.

 

Long.valueOf(resizeVolume.size_mb)+$IncrementSizeInGB*1024

 

Frequent Contributor

Re: Doing Concatenation and not addition

This worked for me:

($increment*1024) + (int)resizeVolume.size_mb

 

resizeVolume.size_mb returns a long value and it somehow gets concatenated.

 

Let me know if it works.

 

-Anil

 

Re: Doing Concatenation and not addition

Hi Anil and Parag,

Thanks for your quick replies, both your solution works.

 

Regards

adai

Re: Doing Concatenation and not addition

Hi WFA Team,

Is this bug fixed in WFA 3.0 GA or atleast in 3.1 RC thats coming soon ?

 

Regards

Adai