Below are the parameters
AssignI = 10 (Max term) - Integer
AssignJ = 2.5 (Requested term) - Double
Current Age = 32
Retirement Age = 60
AssignM = Retirement Age - Current Age i.e 60 -32 = 28 - Integer
Need to get Min(AssignI,AssignJ,AssignM)
Tried math function Math.Min(AssignI, Math.Min(AssignJ, AssignM)) but the output is 0
You are doing the calculation correctly, but the reason you are getting 0 is likely due to type mismatch between Integer & Double arguments.
Math.Min() needs both values to be of the same type.
Convert All values to double : Math.Min(CDbl(AssignI), Math.Min(AssignJ, CDbl(AssignM)))
Convert all to Integer : Math.Min(CInt(AssignI), Math.Min(CInt(AssignJ), CInt(AssignM)))
Based on output you need use double or int accordingly.
You can also convert to array/list and use :
{CDbl(AssignI), AssignJ, CDbl(AssignM)}.Min()
Then outputs of this you can assign to variable output.
Sequence.xaml (8.3 KB)
Yoichi
(Yoichi)
3
Hi,
FYI, another solution
New Object(){i,j,m}.Min(Function(o) CDec(o))
note: this returns object type.
OR
New Object(){i,j,m}.Select(Function(o) CDbl(o)).Min()
note: this return double type
Regards,
1 Like
Hi @sobin_paul
Convert all to double ;
result = {Convert.ToDouble(AssignI), AssignJ, Convert.ToDouble(AssignM)}.Min()
Happy Automation
Anil_G
(Anil Gorthi)
5
@sobin_paul
just convert M and I to double it should work
cheers