Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

String Variable concatenation duplicates first value

edited December 2015 in General
Hi,

I have a variable in the Summary of a subreport that is being used to
turn a table of values into a string. i.e.

Count Desc
2 Item1
1 Item2
4 Item3

becomes: 2xItem1,1xItem2,4xItem3

using: Value := Value + Prods['Count'] + 'x' + Prods['Desc'];

This used to work in RBv7

Now using RBv15, and instead get the following output:

2xItem1,2xItem1,1xItem2,4xItem3

Any ideas?

Thanks,

Darren Ball

Comments

  • edited December 2015
    Hi Darren,

    Variable calculations have been altered slightly since RB 7. If you
    need the OnCalc event of a Variable to fire only once per traversal (as
    you do), you will need to set its VarType property to a numeric type.
    This would however prevent you from displaying your concatenated text
    inside the Variable value.

    One option would be to update the caption of a separate label from the
    OnCalc of a numeric Variable.

    Another would be to perform a simple check to be sure the current field
    value has not already been added to the variable value.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.