Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula problem Post Reply Post New Topic
Author Message
rsoby
Newbie
Newbie


Joined: 23 Aug 2007
Location: United States
Online Status: Offline
Posts: 11
Quote rsoby Replybullet Topic: Formula problem
    Posted: 23 Aug 2007 at 1:15pm
Got a real puzzler on this one - realativly new to CR and BO, but the following is throwing off an error and I can't track what I did wrong:
 
Dim OrgLevel As String
If Not IsNull({ORG_REPORT.LEVEL7_DESCRIPTION}) Then
        OrgLevel = “LEVEL7”
Else
        OrgLevel =  “ORG Level”
    formula = OrgLevel
End If
 
I get the :
                          FORMULA CHECKING ERROR
"A Number, currency amount, boolean, date, time, date-time, or string is expectedhere" 
 
Also is there a way to get different varibles back from 1 formula
ie
Dim OrgLevel As String
Dim OrgNameAs String
If Not IsNull({ORG_REPORT.LEVEL7_DESCRIPTION}) Then
        OrgLevel = “LEVEL7”
        OrgName= "Level 7"
Else
        OrgLevel =  “ORG Level”
        OrgName= "Org"                  <These are what I want to display
 formula = ???WHAT????
End If                                             <If I sent formula = to something -                                                         Thats all I get and I want these as
                                                          seperate  values so OrgLevel &" "
                                                         &OrgName  won't do it
 
Thanks for any help
 
Rich
 
rich_soby@yahoo.com
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 23 Aug 2007 at 2:50pm
I'm not sure about the first error. It means that the possible data types returned from the formula are different. But everything appears to be a string. I would take the line 'formula=orglevel' and move it AFTER the end if statement. That might do the trick.

Re the second question, a formula can only return one value. If you want to display two values, then you need two formulas. Another idea is to make the second variable a shared variable and then have a second formula which simply returns the value of that shared variable.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
rsoby
Newbie
Newbie


Joined: 23 Aug 2007
Location: United States
Online Status: Offline
Posts: 11
Quote rsoby Replybullet Posted: 23 Aug 2007 at 3:58pm
Whats a shared varible and how do you use/call it?
rich_soby@yahoo.com
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 23 Aug 2007 at 4:25pm
Declare the variable as Shared and this lets any formula in the report use it. Here, this formula creates a shared variable:
Shared X As String
X = "hello, world"

Now any formula can use the X variable for whatever they want. This formula just prints it.
Shared X As String
Formula = X


Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
rnareshk
Newbie
Newbie
Avatar

Joined: 19 Jul 2007
Location: India
Online Status: Offline
Posts: 30
Quote rnareshk Replybullet Posted: 23 Aug 2007 at 10:32pm

I would like to add an information regarding Shared variable.

If we want to use a variable in sub-report which is declared and assigned some value in main report, then Shared variables will be used.

If I am wrong please let me know.

Thanks,

Naresh.

Thank You,
Naresh.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 23 Aug 2007 at 11:37pm
To share data with subreports you need to use Global variables.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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.015 seconds.