Report Design
 Crystal Reports Forum : Crystal Reports .NET 2003 : Report Design
Message Icon Topic: While do Loop Post Reply Post New Topic
Author Message
ericooi1976
Newbie
Newbie


Joined: 27 Jun 2007
Online Status: Offline
Posts: 5
Quote ericooi1976 Replybullet Topic: While do Loop
    Posted: 29 Jun 2007 at 4:28am

may i know can i know where can i have some sample of

how to use while do syntax and do while syntax in crystal report -formula field?
 
Thanks
Eric
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 29 Jun 2007 at 8:45am
Brian has a whole chapter on control structure with examples, here is the link:
 
 
Regards
 
John W.
 
IP IP Logged
ericooi1976
Newbie
Newbie


Joined: 27 Jun 2007
Online Status: Offline
Posts: 5
Quote ericooi1976 Replybullet Posted: 02 Jul 2007 at 12:10am
Hi all master,
 
I can not get the result that i wish for, any opinion to advice...Thanks
 
The @Test formula consist of : "abc,def,ghi,".
 
i want the result to be in the like below:
  abc
  def
  ghi
 
------- My code ------
 
Local StringVar AllHour;
Local NumberVar i:=1;
Local StringVar j;
Local NumberVar k:=0;
AllHour := {@Test};
k := length(AllHour);

while i <= k and AllHour <> "" do
(j := ToText(Mid(AllHour, i,InStr(i,AllHour,",")-1)) + chr(10);   
    i := i + 4;
    );
j;

 

Thanks a lot

EricConfused

IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 04 Jul 2007 at 5:53am

Perhaps I am reading the formula wrong. But you have i = 1 and k = 0 then in the formula you have the While condition as i <= k which is while 1 <= 0 which will never be true. I do not know if this is a problem or not I just found it a bit confusing.

If you have not already done this you may try writing the formula with actual values, ones that are vailid, then run it and see if it gives errors. One it runs as you want then replace the values with the variables.

 
Regards,
 
John W.
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.032 seconds.