3 Replies Latest reply on May 25, 2014 10:59 PM by TKnTexas

# Calculated field that repeats, how is it done ?

### Title

Calculated field that repeats, how is it done ?

### Post

I have a calculation field that has 10 repetitions.

The calculation so far has produced a variable \$result that contains a series of numbers, each separated by ","

If the calculation returns \$result as it stands, the first repetition of the field takes the entire string.

How do I return \$result so that it fills each of the field's repetitions with one of the values ?

I've tried replacing "," with Char(29) - the Group Separator, but that doesn't seem to work.

thanks,

rob.

• ###### 1. Re: Calculated field that repeats, how is it done ?

There is a caveat for a single number field when used in a calculation with repetitions, using EXTEND with the non-repetition field.  I was not able to duplicate a problem.  I have not worked with REPEATING fields for a long time, using related fields instead.

I created three repeating fields, QTY, PRICE, and EXT.  I created a non-Repeating SUM field to sum the extend amounts.  Both QTY and PRICE are number with 5 repetitions.  EXT is a calculated field QTY * PRICE.  Sum is a calculated field that is SUM(EXT).

All worked as I would hope.

• ###### 2. Re: Calculated field that repeats, how is it done ?

Thanks, that at least shows calculations can return repeating values.

Here's my calculation, defined to return a numeric result with 10 repetitions,

Let(
[
\$iar = Alpacas::IAR;

\$query = "
SELECT ancestor_IAR
FROM Ancestor_steps
WHERE IAR = ? and  mismatch_on_inbreeding_precentage = ?
";
\$result = ExecuteSQL (  \$query;  ""; ¶; \$iar; "Yes")
];

\$result
)

I can't force \$result to be treated as something that has repetitions. I thought using Char(29) instead of ¶ would do the trick, but alas no.

• ###### 3. Re: Calculated field that repeats, how is it done ?

http://buzz.beezwax.net/2011/10/29/working-with-repeating-fields

This has a good discussion on the subject.  Maybe this will help.