Crystal Syntax in Formula Editor for passing a Parameter Field to a calculation of two fields where the Parameter is only part of one of the field names in the calculation

I wish to add the value of to fields together. e.g.
{Balance} + {Value@1}

The fields available in the table = {Balance}, {Value@1],{Value@2],{Value@3],{Value@4],{Value@5],{Value@6],{Value@7],{Value@8],{Value@9],{Value@10]

But I have a Parameter that allows the user to inter a number value 1 to 10 for the purpose of selecting the correct Value field.
Prompt  = "Enter Value Number"
User returns 4
Therefore the calculation should  = {Balance} + {Value@4}

Ideally If my Parameter was called "UserValue" then my formula would look like this:
{Balance} + {Value@{?UserValue}}

Please help me understand where my syntax is wrong.

Who is Participating?
analliahConnect With a Mentor Commented:
create a formula @p_formula add a if statement
 if {?parameter} = 1 then {Value@1} else
 if {?parameter} = 2 then {Value@2} else
so on

on you existing formula it would be
{Balance} + @p_formula
if you parameter value is = to your table value,
 then just create a formula @p_formula

on you existing formula it would be
{Balance} + @p_formula
MchallinorAuthor Commented:
Ok, I accept that your answer maybe a possibility.

I was curious about the naming of the field by the developer.
The field name is Value@1
When you hover the cursor over this field it shows a tip  [Value](number)
In a database viewer the field title is called Value[1]

It seems to me that there is a stored value and you can pass a (number) to it to select the Value stored at that number?

Sorry if this sounds confusing.

If it is an array then you could use the parameter as an index.


I suspect thought that the field name in the database or the view is Value[1]

MchallinorAuthor Commented:
No sorry that doesn't work.

I agree with your thoughts, I thought it was an array field, but perhaps it is not.

I think first suggestion by analliah is what I need to use.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.