Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula Help Post Reply Post New Topic
Author Message
dkalsow
Groupie
Groupie
Avatar

Joined: 10 Jan 2011
Location: United States
Online Status: Offline
Posts: 65
Quote dkalsow Replybullet Topic: Formula Help
     Posted: 02 May 2011 at 9:22am
Good Afternoon,
 
I have the following formula.  It works fine until I added Case 2, now I get the error:  "The ) is missing."  Any help would be greatly apprecated.
 
Global stringVar stvField13 := "";
Global stringVar stvField14 := "";
Global stringVar stvField15 := "";
Global stringVar stvField16 := "";
Global stringVar stvField17 := "";
Global stringVar stvField18 := "";
Global stringVar stvField19 := "";
Global stringVar stvField20 := "";
Global stringVar stvField21 := "";
Global stringVar stvField22 := "";
Global stringVar stvField23 := "";
Global stringVar stvField24 := "";
Global stringVar stvField25 := "";
Global stringVar stvField26 := "";
Global stringVar stvField27 := "";
Global stringVar stvField28 := "";
Local NumberVar i := 0;
Local NumberVar Savei :=0;
Local NumberVar nbvLenght := length({Po_ProviderInvoiceDetailExtensionBase.Po_AdmissionInformation});
Local NumberVar nbvLoadVar := 0;
//{Po_ProviderInvoiceDetailExtensionBase.Po_AdmissionInformation}
for i := 1 to nbvLenght Do
(
if mid({Po_ProviderInvoiceDetailExtensionBase.Po_AdmissionInformation}, i, 1)="-" then
(
nbvLoadVar := nbvLoadVar+1;
savei := i;
Select nbvLoadVar
   Case 1:
      stvField13 := left(left({Po_ProviderInvoiceDetailExtensionBase.Po_AdmissionInformation},i-1)+space(3),4);
   Case 2:
      savei := i;
      );
);
stvField13;
Thanks :)
dkalsow
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 May 2011 at 3:20am
looking at the example in CR Help, it would appear that you only use the ';' at the end of the Select statement, so the ';' at the end of Case 1: terminiates the statement, and CR is confused when it encounters the Case 2:
 
Try removing it.
 
HTH
IP IP Logged
dkalsow
Groupie
Groupie
Avatar

Joined: 10 Jan 2011
Location: United States
Online Status: Offline
Posts: 65
Quote dkalsow Replybullet Posted: 03 May 2011 at 3:34am

After doing that, now crystal highlights case 2 and the line under it and says "A string is required here."

I am still not doing something right.
Thanks :)
dkalsow
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 May 2011 at 9:52am
ok, CR wants the same output for all the different banches of a if/then, which is really all that Switch is. 
It's a silly solution, but add "" after the savei.  Might need to add () around the case, but it should work.
IP IP Logged
dkalsow
Groupie
Groupie
Avatar

Joined: 10 Jan 2011
Location: United States
Online Status: Offline
Posts: 65
Quote dkalsow Replybullet Posted: 03 May 2011 at 10:35am
that did it!
 
 
Thanks :)
dkalsow
IP IP Logged
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