Rounding numbers in universal functions/macros Answered

Cameron Scully

Is there a way to round and @STORE or variable within a macro function? We are trying to compare 2 numbers with different decimal numbers and it would help if they could be rounded to a specific number of decimal places.

Comments

3 comments

  • Comment author
    Yaremi Miranda Lopez
    • Official comment

    Hello Cameron,

    In this case, you can use SQL Syntax to round the numbers you need, here is an example of the syntax that you can use:

    @STORE3 = SQL(‘SELECT CardCode FROM …’);

    You can learn more about variables reading the Macro Conditional Commands Guide that you can download here:

    https://support.boyum-it.com/hc/en-us/articles/204284198-Guide-Understanding-Macro-Conditional-Commands

     

     

  • Comment author
    Cameron Scully

    Hello,

    In our case, the number we want to round is a number that is entered on a sales order line. The order wouldn't be saved/Added yet so we wouldn't be able to query the database for it, we would be using the $[$#.#.#] notation to get the value from the field.

    0
  • Comment author
    Yaremi Miranda Lopez

    Hello Cameron, you can also use the suggested tip and round the value using the Synamic Syntax $[$item.column,type]

    For example:

    @STORE3 = SQL(‘SELECT Round($[$38.1.15],2)…’);

    1

Please sign in to leave a comment.