Amour22015

asked on

# Crystal Reports 2008 - Formulas inside each field

Hi and thanks,

I am trying to use formulas that are inside of fields?

Example:

I have a Validation Table (SQL Table)

In this table/Fields there are formulas:

[ValTable].[Val1] = "[Report_SP_MAIN].[Tax_Type]='3'" Or what ever Formula there is in that field.

I have selected the Tables involved:

1.ValTable

2. Report_SP_MAIN

3. Report_SP_Charactor

Can this be done?

Something like:

If [ValTable].[Val2] <> "" And [ValTable].[Val1] <> "" Then

([ValTable].[Val2] & [ValTable].[Val1]) + 1 (<== to add a count and placed in the group)

Else

If [ValTable].[Val2] = "" Then

[ValTable].[Val1] + 1(<== to add a count and placed in the group)

Else

0

What I am trying to do:

When it reads the formula (that is inside the field) it will do that formula (that is based on the fields that are in the other tables) and add a count to each group.

Attached is the ValTable but in this case is a Excel Spreadsheet that I have already copied into SQL Table...

Thanks...

ValTab.xlsx

I am trying to use formulas that are inside of fields?

Example:

I have a Validation Table (SQL Table)

In this table/Fields there are formulas:

[ValTable].[Val1] = "[Report_SP_MAIN].[Tax_Typ

I have selected the Tables involved:

1.ValTable

2. Report_SP_MAIN

3. Report_SP_Charactor

Can this be done?

Something like:

If [ValTable].[Val2] <> "" And [ValTable].[Val1] <> "" Then

([ValTable].[Val2] & [ValTable].[Val1]) + 1 (<== to add a count and placed in the group)

Else

If [ValTable].[Val2] = "" Then

[ValTable].[Val1] + 1(<== to add a count and placed in the group)

Else

0

What I am trying to do:

When it reads the formula (that is inside the field) it will do that formula (that is based on the fields that are in the other tables) and add a count to each group.

Attached is the ValTable but in this case is a Excel Spreadsheet that I have already copied into SQL Table...

Thanks...

ValTab.xlsx

ASKER CERTIFIED SOLUTION

membership

Create a free account to see this answer

Signing up is free and takes 30 seconds.

**No credit card required.**
Correct. A report can only be changed by someone who has the designer license.

In general end-users of the report cannot change the report.

mlmcc

In general end-users of the report cannot change the report.

mlmcc

Just to add to what mlmcc said:

CR does not have an "evaluate" function that will try to interpret a string as a formula.

If the formulas are simple enough, you might be able to interpret them in a CR formula that would parse the string, pick out the operators and operands, etc.

Or, if there is a standard set of formulas, maybe you could use a code for each formula and the report would know how to interpret each code.

Of course, either way, the report would also have to have all of the data required by the formulas available, so you would have to include any tables that might be required in the report.

James

CR does not have an "evaluate" function that will try to interpret a string as a formula.

If the formulas are simple enough, you might be able to interpret them in a CR formula that would parse the string, pick out the operators and operands, etc.

Or, if there is a standard set of formulas, maybe you could use a code for each formula and the report would know how to interpret each code.

Of course, either way, the report would also have to have all of the data required by the formulas available, so you would have to include any tables that might be required in the report.

James

ASKER

I've requested that this question be closed as follows:

Accepted answer: 0 points for Amour22015's comment #a38584778

for the following reason:

Ok, Thanks

Accepted answer: 0 points for Amour22015's comment #a38584778

for the following reason:

Ok, Thanks

I believe the comments provided helped you find a solution and as such deserve to be selected as the answer or an assisted answer.

mlmcc

mlmcc

ASKER

Sorry I selected the wrong post, thanks

ASKER

I am writting the Crystal Reports to be placed into a new system.

The current system (not Crystal Reports) lets the user input a formula into a field and then based on the formula there is some action (in this case a count). See attached ValTab.

Lets take:

Row: 2, Col: Valid1 and Valid2

what that does is:

If conditions are both meant then it adds 1 (as a problem found)

So each row indicates a check agaisnt the Table(s) and each row would be a group.

So what you are saying is this can not be done in Crystal Reports?

I would have to write each formula in Crystal Reports and the user would not be able to add more formulas to the report?

Something like:

If Row2 then

Else

Row3

Else

Row4

and so on only each row I would write a formula like:

If [TEMP_PWC_Report_SP_MAIN].

1

Else

If INLIST([TEMP_PWC_Report_SP

1

Else

and so on

Else

0

Thanks