Book a Demo

Author Topic: Addition/subtraction in DLL templates ?  (Read 4251 times)

qal

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Addition/subtraction in DLL templates ?
« on: February 21, 2017, 06:42:59 pm »
Hello,

Is there a way of making addition or subtraction operations inside DDL template ? I was trying to get some substring and i find out that typing $numvariableA - $numvariableB just results in a string output with minus in it. I find workaround, but its a little weird and it will be better if i just could use a subtraction.


Thanks in advance,
Qal

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Addition/subtraction in DLL templates ?
« Reply #1 on: February 21, 2017, 08:48:17 pm »
I always recommend to just ignore this awkward scripting and use the API for transformation and code generation. That will not limit you in such basic things. It's a greater start-up since you start at scratch. But once you have some scaffold you can do much much more.

q.

qal

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Addition/subtraction in DLL templates ?
« Reply #2 on: February 22, 2017, 06:10:17 pm »
Ok, Thanks for the advice. I'm gonna try it out :}

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Addition/subtraction in DLL templates ?
« Reply #3 on: February 27, 2017, 12:44:05 pm »
Hi Qal,

There are actually function macros available in the code gen / transformation templates for MATH_ADD, MATH_SUB and MATH_MULT.  Unfortunately they don't seem to be documented though.  We will look into getting the help updated.

MATH_ADD(x, y)
Returns the value of x+y.

MATH_MULT(x, y)
Returns the value of x*y.

MATH_SUB(x, y)
Returns the value of x-y.

Note: x and y for above parameters can be passed as either numerals or strings.  E.g. %MATH_ADD("10", "2")% returns 12.