0

I'm having a problem with the following code.I would like to display the amount of money of people with the $ sign. In the interface there is a monitor that shows the actual money of an agent, but with the function word it shows to me all the decimal places possible (I inserted 2, but seems it doesn't care). The code is inside the monitor's reporter. Thanks in advance.

word "$" sum [money] of people

  • I already showed you what I tried. I inserted word "$" and then the money sum of the agent, but the problem still remains. I mean, is not a super big problem, I can't try many things. – carlitosnuzzi Nov 06 '22 at 18:44
  • The example in this case is: when I start the procedure, the monitor shows to me 1650.1937947481, I would like to print only the first 2 decimal position, I tried also to set the decimal position of the monitor, but still not works. – carlitosnuzzi Nov 06 '22 at 18:46

1 Answers1

1

When you use the function word, you are no longer displaying a number but rather a string. Because of that, the notion of decimal places no longer applies because you are looking at text. That means you need to change the number of decimals the number has before you turn it into a string. Precision is a primitive that allows you to manipulate the number of decimals. Combining that with your code gives the following:

word "$ " precision sum [money] of people 2

Displayed below with brackets to make it a bit more clear what happens when.

(word "$ " (precision (sum [money] of people) 2) )
LeirsW
  • 2,070
  • 4
  • 18
  • You're welcome. Please accept the answer by upvoting it, that way the question will be marked as solved. Then other people who want to help won't have to bother with coming in here again. – LeirsW Nov 07 '22 at 15:48