Print Page | Close Window

Using a Text object in a formula

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=329
Printed Date: 17 May 2024 at 10:32pm


Topic: Using a Text object in a formula
Posted By: Indigo04
Subject: Using a Text object in a formula
Date Posted: 15 Mar 2007 at 9:09am
Hi
 
Is there a way to somehow get the value of a text object into a formula field?
 
Basically I need to fill values in a report by an outside process in ASP.
 
Is there some way to do this? Access in old ASP any kind of object in the report to later use this object inside a formula?
 
thanks
 
 



Replies:
Posted By: hilfy
Date Posted: 15 Mar 2007 at 10:05am

Can you use parameters instead of directly setting the values of the text objects?  This way you would put the parameters on the report in place of the text boxes and you would have the parameter values available for use in formulas.

 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: Indigo04
Date Posted: 15 Mar 2007 at 10:22am
Hi Dell, thank you for the reply.
 
The question is if I can access these parameters in ASP.
 
I know I can set values of text objects by iterating the crystal object sections and then ReportObjects, but what about these parameters?
 
these values to be used in the formula have to be set in ASP.
 
 


Posted By: hilfy
Date Posted: 15 Mar 2007 at 10:38am
You can iterate through the parameters in ASP...We used to do it before we moved to the .NET viewer.
 
Looking at the old code, you use the Parameterfields.getItembyName(<item>).SetCurrentValue where <item> is the name of the parameter that you want to set.  There are two parameters to SetCurrentValue method - the value of the parameter and a number that indicates the type.  We only pass integers and strings so our calls look like this:
oRpt.Parameterfields.getItembyName(item).SetCurrentValue CInt(temp), 7
or
oRpt.Parameterfields.getItembyName(item).SetCurrentValue CStr(temp), 12
 
You could find the information for other types of values on the BO developer website.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: Indigo04
Date Posted: 18 Mar 2007 at 6:14am
I can't manage to pass anything to the report.
 
When I fill a parameter like this-
 
objReport.Parameterfields.getItembyName("@Title").SetCurrentValue "TEST", 12
 
OR
 
objReport.ParameterFields("@Title").SetCurrentValue("TEST")
 
 it doesn't appear to have a value when the report loads,
 
and when I fill a formula field like this
 
objReport.FormulaFields.getItembyName("@Title").Text = "TEST"
 
and I place a blank formula of @Title in the report I get an error-
 
The remaining text does not appear to be part of the formula


Posted By: Indigo04
Date Posted: 18 Mar 2007 at 8:14am
 
Ok, I can fill a formula field using -  chr(34) & "text" & chr(34)
 
but ParameterFields No can do.
 
No comprende.
 
Going crazy here.


Posted By: hilfy
Date Posted: 18 Mar 2007 at 3:40pm
Try using CStr("TEST")
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: hilfy
Date Posted: 18 Mar 2007 at 3:41pm
Also, are you calling .Load after setting the params?  I think you may need to .Load, set the params, and then run the report.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window