Print Page | Close Window

While do Loop

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=942
Printed Date: 06 May 2024 at 11:36am


Topic: While do Loop
Posted By: ericooi1976
Subject: While do Loop
Date 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



Replies:
Posted By: jkwrpc
Date Posted: 29 Jun 2007 at 8:45am
Brian has a whole chapter on control structure with examples, here is the link:
http://www.crystalreportsbook.com/Crystal_Reports_XI.asp?Page=7_5 - http://www.crystalreportsbook.com/Crystal_Reports_XI.asp?Page=7_5
 
 
Regards
 
John W.
http://www.CustomReportWriters.net - www.CustomReportWriters.net
 


Posted By: ericooi1976
Date 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 := mailto:%7b@Test - {@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



Posted By: jkwrpc
Date 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.
http://www.CustomReportWriters.net - www.CustomReportWriters.net



Print Page | Close Window