Thanks so much for popping back in to share the solution that you found with the community! I'm sure that can help someone out that runs across this in the future :)

Hi Leslie, That is OK. My problem was that I was counting the time that a person was using and interaction and then dividing this total by 4 and wanted a whole number to display.

It did not matter if it was truncated or rounded but I did not want an decimals.

Worked really well in the end with a few brains working it out. :)

## 9 Replies

You can use a simple JavaScript, e.g. the round() method to get only whole numbers.

Hi Michael, That was quick.

How do I write the code as I am not a JS expert

See attached a quick example of how this might work.

Rounded_MH.storyThanks, Will check it out. :)

Using JavaScript we finally cracked it.

Using a variable "thenum" that counts the seconds that the module has been open, we did this.

Code:

player=GetPlayer();

var mynum = player.GetVar("thenum");

player.SetVar("thenum",Math.round(mynum));

Having a field with %thenum% displays a whole number. :)

Hey Ross,

Thanks so much for popping back in to share the solution that you found with the community! I'm sure that can help someone out that runs across this in the future :)

Hi Leslie, That is OK. My problem was that I was counting the time that a person was using and interaction and then dividing this total by 4 and wanted a whole number to display.

It did not matter if it was truncated or rounded but I did not want an decimals.

Worked really well in the end with a few brains working it out. :)

Thanks very much Ross. This has really helped me out.

Hi Louisa, Glad the community can help each other. :)

## This discussion is closed. You can start a new discussion or contact Articulate Support.