AnsweredAssumed Answered

Re: How to create a custom function using tail recursion technique

Question asked by micromd on Jul 20, 2011
Latest reply on Jul 20, 2011 by raybaudi

Title

Re: How to create a custom function using tail recursion technique

Post

I have a registration form with about 20 fixed filling areas (with empty filling squares in each filling area) and want to fill in each empty square with one character from my database information, e.g. a name like "JACKIE" and the form has only 4 spaces to fill in and I have to truncate the word "JACKIE" to "JACK" and the filling squares are large. I need to pad the word "JACK" with spaces like "J A C K" to fill in the form.

I can easily create a generic script to truncate the word "JACKIE" to "JACK" and separate the characters with spaces with a loop script step.

I read about the tail recursion but could not understand how to create a custom function with a recursive loop.

I wonder if any FM experts can help me to create a custom function e.g. fnPaddedWord (word; characters; spaces) so that all I need is to provide (1) the word to fill in (i.e. JACKIE), (2) the number of characters to fill in (i.e. 4) & (3) fixed amount of spaces to separate the characters to be able to fill in the required area as "J A C K"

Outcomes