Book a Demo

Author Topic: Split text in template - Calculation not possible  (Read 2766 times)

Christhonie

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Split text in template - Calculation not possible
« on: August 20, 2009, 10:58:29 pm »
Hi all,

How do I go about doing basic calculations (increment a variable in this case) in a code or transformation template.  I need to separate a string into 2 parts around a literal as such;

I can find the left side by;
$position=%FIND($parameter1, ".")%
$left=%LEFT($parameter1,$position)%

But I now need the right part and need to add a simple one to the index, like;
$right=%MID($parameter1,$position+1)%

I can not get position to increment.  How do I get this to work?  Surely this simplistic case should be catered for?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Split text in template - Calculation not possi
« Reply #1 on: August 21, 2009, 11:51:09 am »
There isn't any math in the templates.

If it helps I have achieved that same goal you have without it my using two calls to mid.

$right=%MID($parameter1,$position)%
$right=%MID($right,1)%
« Last Edit: August 21, 2009, 11:52:34 am by simonm »

Christhonie

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Split text in template - Calculation not possi
« Reply #2 on: August 22, 2009, 11:03:23 am »
Thanks Simon, that will do the trick for now.

I am saddened to find that you have developed your own templating (scripting) language from scratch, having numerous limitations in my eyes, when it is so easy to take an existing scripting implementation, like VBScript, Groovy, etc, and wrap it with your domain specific language.  Not only do you use a familiar syntax, but also gain from existing functionality and tools like design-time syntax highlighting, code completion, debugging tools, etc. that come with most interpreter implementations.  In general: Do not re-invent the wheel.

That said, I can complement you on an otherwise feature rich and stable product.  We are proud users of your product.  Keep up the good work.