round function

DataGraph Forums General Getting Started round function

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7479
    thopa
    Participant

      Hi,

      Might be a stupid question:

      I wanted to use the round function. I have a column with number with 5 digits. I would like to only have 3. The column is named “A”. I created an expression column and typed in: round(“A”, 3). The result is “illegal argument” for this function. Leaving out the 3 works for rounding to a total number.

      I thought the round function would be supposed to work with an argument for the number of digits I would like to have.

       

      Any suggestions on what I am doing wrong?

       

      Thanks

      #7503
      dgteam
      Moderator

        The round function only rounds to the nearest integer.  You could try something like this: round(A*100)/100.

        Here is an example using an Expression variable.  Note that you only need quotes around a variable name if it has a space in it.

        Untitled 3

         

        FYI – this may not have anything to do with why you want to round the numbers, but in case you’re using a number as a label there are built in formatting menus when you select a number column for a label. For example here’s a screenshot of the points command where a number column has been designated for the point label.  Also, just handy thing to know 🙂

        Untitled 3

         

        #7507
        thopa
        Participant

          Hi,

          thanks for your reply.

           

          Actually, your suggestions was exactly what I used as a workaround. I thought this could not have been the cleanest way to deal with this. But it works.

           

          I needed to round the values because I wanted to map these values to others which have less digits. Is there a way to map value with a tolerance? Or do the value really have to be an exact match to work in the mapping function?

           

          Thanks for your help

          #8178
          dgteam
          Moderator

            Wanted to follow-up on this as the in current beta (and next version of DG) the ’round’ function can now take a second argument, e.g. round(π,2) = 3.14.

            Seeing your second question on the mapping, this does require an exact match.  Anyway, hope the round function works better for you now!

          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.

          DataGraph Forums General Getting Started round function