Solved

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

Posted on 2008-06-17
5
1,143 Views
Last Modified: 2013-11-05
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.
E.g.
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.

Thanks
MC
0
Comment
Question by:Mchallinor
  • 2
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
analliah earned 500 total points
ID: 21803324
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
0
 
LVL 5

Expert Comment

by:analliah
ID: 21803344
if you parameter value is = to your table value,
 then just create a formula @p_formula
 {?parameter}


on you existing formula it would be
{Balance} + @p_formula
0
 

Author Comment

by:Mchallinor
ID: 21803506
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.

0
 
LVL 100

Expert Comment

by:mlmcc
ID: 21804494
If it is an array then you could use the parameter as an index.

Value[?Parameter}]

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

mlmcc
0
 

Author Comment

by:Mchallinor
ID: 21804596
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.
Thanks

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now