For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Crystal Reports > January 2006 > Select Case Syntax









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Select Case Syntax
Sherwood

2006-01-23, 7:07 pm

Greetings,

I'm a relatively new Crystal user and was trying to use the following syntax
below in a custom formula. When I run a check on it, however, I receive the
following error message (and it highlights the word "Case" after the word
"Select"):

"A number, currency amount, boolean, date, time, date-time, or string is
expected here."

What I am trying to do is check the value of the field,
"Health_Coverage_Type", and then add 1 to the total count if the value is
"Individual".

At any rate, is there anything wrong with my syntax below? [Note: I am
using a SQL Server Stored Procedure as the data source for this report].

Thanks in advance!

Select Case({rpt_ft_active_employees_benefits;1
.HEALTH_COVERAGE_TYPE})
Case "Individual"
Dim Total_Individual_Health as integer

Total_Individual_Health = Total_Individual_Health + 1
formula = Total_Individual_Health
End Select


--
Sherwood
Shariq

2006-01-23, 7:07 pm

You problem is probably in the following line of code:
{rpt_ft_active_employees_benefits;1.HEALTH_COVERAGE_TYPE}

"Sherwood" wrote:

> Greetings,
>
> I'm a relatively new Crystal user and was trying to use the following syntax
> below in a custom formula. When I run a check on it, however, I receive the
> following error message (and it highlights the word "Case" after the word
> "Select"):
>
> "A number, currency amount, boolean, date, time, date-time, or string is
> expected here."
>
> What I am trying to do is check the value of the field,
> "Health_Coverage_Type", and then add 1 to the total count if the value is
> "Individual".
>
> At any rate, is there anything wrong with my syntax below? [Note: I am
> using a SQL Server Stored Procedure as the data source for this report].
>
> Thanks in advance!
>
> Select Case({rpt_ft_active_employees_benefits;1
.HEALTH_COVERAGE_TYPE})
> Case "Individual"
> Dim Total_Individual_Health as integer
>
> Total_Individual_Health = Total_Individual_Health + 1
> formula = Total_Individual_Health
> End Select
>
>
> --
> Sherwood

Rob Diamant

2006-01-23, 7:07 pm

Are you using Crystal or Basic syntax for your formula. It looks like you
are Basic code with Crystal Syntax expected.

Rob

"Sherwood" <Sherwood@discussions.microsoft.com> wrote in message
news:8DC7F914-27DE-477D-BCA1-F5DEC57CAC2E@microsoft.com...
> Greetings,
>
> I'm a relatively new Crystal user and was trying to use the following
> syntax
> below in a custom formula. When I run a check on it, however, I receive
> the
> following error message (and it highlights the word "Case" after the word
> "Select"):
>
> "A number, currency amount, boolean, date, time, date-time, or string is
> expected here."
>
> What I am trying to do is check the value of the field,
> "Health_Coverage_Type", and then add 1 to the total count if the value is
> "Individual".
>
> At any rate, is there anything wrong with my syntax below? [Note: I am
> using a SQL Server Stored Procedure as the data source for this report].
>
> Thanks in advance!
>
> Select Case({rpt_ft_active_employees_benefits;1
.HEALTH_COVERAGE_TYPE})
> Case "Individual"
> Dim Total_Individual_Health as integer
>
> Total_Individual_Health = Total_Individual_Health + 1
> formula = Total_Individual_Health
> End Select
>
>
> --
> Sherwood



Sherwood

2006-01-23, 7:07 pm

How else would I reference the field, since the stored procedure is named,
"rpt_ft_active_employees_benefits" and the actual field name is
"HEALTH_COVERAGE_TYPE"? [Note: When I double-clicked the field in the field
tree, this is what is displayed].

Thanks!
--
Sherwood


"Shariq" wrote:
[color=darkred]
> You problem is probably in the following line of code:
> {rpt_ft_active_employees_benefits;1.HEALTH_COVERAGE_TYPE}
>
> "Sherwood" wrote:
>
Sherwood

2006-01-24, 7:07 pm

Thanks. I appreciate it.
--
Sherwood


"Rob Diamant" wrote:

> Are you using Crystal or Basic syntax for your formula. It looks like you
> are Basic code with Crystal Syntax expected.
>
> Rob
>
> "Sherwood" <Sherwood@discussions.microsoft.com> wrote in message
> news:8DC7F914-27DE-477D-BCA1-F5DEC57CAC2E@microsoft.com...
>
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com