cancel
Showing results for 
Search instead for 
Did you mean: 

Formula in a database field

Former Member
0 Kudos

Hello,

I would define a formula in a field of my database and later use it in a crystal report. The idea is to make configurable the output.

The field contains for example "{table.field}+{table.field2}".

My problem is that Crystal doesn't interpret the formula and consider the field as text. The output shows the formula.

Is there a way for the content of the field is regarded as a formula?

I use CR 10.0.5.1506 and sql server 2008.

Thank you in advance for your help.

Regards,

Stephane

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Create the same formula in Crystal and don't use the field with the formula

Former Member
0 Kudos

I can't.

Some users have the right to define indicators (operands and arithmetic). These data are stored in a database. I must use this formula in the report to calculate and display these indicators.

Former Member
0 Kudos

Steph,

What kind of database are you using?

Jason

Former Member
0 Kudos

I use sql server 2008

Former Member
0 Kudos

Steph,

I've been using SQL Server for more than a few years now and I've never heard of "indicators"... That's not to say that there isn't, I've just never heard of it.

I'm thinking that you're either working with a data warehouse (lots of unfamiliar terminology there) or you're referring to a "user defined function" (udf).

If in fact you are working with a udf, you'll need to use either a SQL Expression field or use a Command as your data source.

A SQL Expression field allows you access functions that are specific to your database. Just use the same syntax that you would use if you were writing out the query in SSMS.

A Command... Allows to to write and test your query in SSMS and then simply paste it into the Command window and use that as your data source.

HTH,

Jason

Answers (2)

Answers (2)

Former Member
0 Kudos

I keep the formula in a database. I use a field whose type is varchar.

In the report (in preview mode or after generation), the formula appears without any interpretation. The following text appears "{table.field}+{table.field2}".

Former Member
0 Kudos

No matter whether its a numeric or varchar

define the column as varchar in DB

and use totext(command.column_name) in crystal report....this might help

Thanks,

Ganesh

Former Member
0 Kudos

>

> I keep the formula in a database. I use a field whose type is varchar.

>

> In the report (in preview mode or after generation), the formula appears without any interpretation. The following text appears "{table.field}+{table.field2}".

Create the same formula in CR.

Former Member
0 Kudos

you create a field in a table to use? how is it defined in the database?

Is there a way for the content of the field is regarded as a formula????????? please be more explicit on this

when you query the table what displays the result of the formula or the formula it self?