Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Using a Text object in a formula Post Reply Post New Topic
Author Message
Indigo04
Newbie
Newbie


Joined: 15 Mar 2007
Location: Bermuda
Online Status: Offline
Posts: 4
Quote Indigo04 Replybullet Topic: Using a Text object in a formula
    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
 
 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet 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
IP IP Logged
Indigo04
Newbie
Newbie


Joined: 15 Mar 2007
Location: Bermuda
Online Status: Offline
Posts: 4
Quote Indigo04 Replybullet 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.
 
 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet 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


Edited by hilfy - 15 Mar 2007 at 10:38am
IP IP Logged
Indigo04
Newbie
Newbie


Joined: 15 Mar 2007
Location: Bermuda
Online Status: Offline
Posts: 4
Quote Indigo04 Replybullet 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
IP IP Logged
Indigo04
Newbie
Newbie


Joined: 15 Mar 2007
Location: Bermuda
Online Status: Offline
Posts: 4
Quote Indigo04 Replybullet 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.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 18 Mar 2007 at 3:40pm
Try using CStr("TEST")
 
-Dell
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet 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


Edited by hilfy - 18 Mar 2007 at 3:50pm
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.