|
-
Aug 9th, 2006, 03:16 AM
#1
Thread Starter
New Member
control structure in crystal reports 8.5
i was trying to execute this algorithm:
for x = 0 to 10
x <-- this part should print the value
i was expecting that in the report, it will display the numbers 0 to 10 but it only displays the last value
i was hoping to use this in my recordset containing date range. in my recordset, not all the dates are included (e.g. 01/01/2006 - 01/05/2006 and the available dates are that of 1,3,5). i need to print all the dates in the range.
is there any way to do this?
God's in His heaven, All's right in the world.
Your heart is like glass, very fragile...
Someday we'll share this cigarette
You and me like we used to
Outside the dark parking lot
Where you told me life happens once you close your eyes
-
Aug 9th, 2006, 12:31 PM
#2
Lively Member
Re: control structure in crystal reports 8.5
Yes.
You have to do this (BTW Not tested, just off the top of my head)
Create a local variable in the formula box
do you loop and concatenate the value on the variable
at the end, put formula = variable.
eg: using Basic format in the formula field
Dim a as string
for x = 0 to 10 step 1
a = a & toText(x)
loop
formula = a
That should do it.
Energy can be neither created not destroyed. It can only be wasted.
Red Green
-
Aug 10th, 2006, 08:18 PM
#3
Thread Starter
New Member
Re: control structure in crystal reports 8.5
 Originally Posted by King_George
Yes.
You have to do this (BTW Not tested, just off the top of my head)
Create a local variable in the formula box
do you loop and concatenate the value on the variable
at the end, put formula = variable.
eg: using Basic format in the formula field
Dim a as string
for x = 0 to 10 step 1
a = a & toText(x)
loop
formula = a
That should do it.
thanx for the help.
tried it but it returned an error: "formula cannot call itself directly or indirectly" or sumthing like that.
going back to your example, instead of concatenating it, i need to insert a carriage return after each value printed.
using your example:
0
1
2
3
4
5
thanx again for the help
God's in His heaven, All's right in the world.
Your heart is like glass, very fragile...
Someday we'll share this cigarette
You and me like we used to
Outside the dark parking lot
Where you told me life happens once you close your eyes
-
Aug 10th, 2006, 08:57 PM
#4
Lively Member
Re: control structure in crystal reports 8.5
 Originally Posted by BenchBrat87
thanx for the help.
tried it but it returned an error: "formula cannot call itself directly or indirectly" or sumthing like that.
going back to your example, instead of concatenating it, i need to insert a carriage return after each value printed.
using your example:
0
1
2
3
4
5
thanx again for the help
Did you create a formula field and put the code I showed inside it? Remember that code will display what you tell it to display. The way I have it works for me on CR8.5.
I created a formula field, opened it up, added the code, saved it and then put the field on the report. Poof it showed exactly what I thought it would. Anyways if you want to put a line feed character, I can't check right now because I'm not at work, but it can be done. Check the help file for the carriage return code used by CR.
HTH
Energy can be neither created not destroyed. It can only be wasted.
Red Green
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|