Enthusiast
Enthusiast

no Math.round. Now what?

Jump to solution

I am attempting to roun a number that is coming out of one of my workflows to the first decimal point for reporting purposes, however VCO doesnt have the Math.round function.   Does anyone have any reccomendations on an alternative way to do this?

0 Kudos
1 Solution

Accepted Solutions
VMware Employee
VMware Employee

vCO has Math.round(); Just not documented in the API search ...

var float1 = 1.2345;
System.log(Math.round(float1));

[2012-05-16 18:37:45.563] [I] 1

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter

View solution in original post

0 Kudos
2 Replies
Leadership
Leadership

Hi!

1. You could try to give the scripts access to the Java Math class. See here for an howto:

http://mighty-virtualization.blogspot.de/2011/01/vco-access-to-java-classes.html

2. Try to find some examples how to build a round in pure Javascript. maybe you can find something here:

http://www.vcoportal.de/2012/03/140bytes/

Cheers,

Joerg

www.vcoportal.de - Orchestrate. Your Cloud.
VMware Employee
VMware Employee

vCO has Math.round(); Just not documented in the API search ...

var float1 = 1.2345;
System.log(Math.round(float1));

[2012-05-16 18:37:45.563] [I] 1

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter

View solution in original post

0 Kudos