Print Page | Close Window

Increment a column value by the parameter value

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22926
Printed Date: 29 Apr 2024 at 3:22pm


Topic: Increment a column value by the parameter value
Posted By: Provalian
Subject: Increment a column value by the parameter value
Date Posted: 18 Feb 2021 at 3:51am
I have a column value that I want to increment by the parameter value and display the array

Column value = 45000
Parameter Value = 5

Report Result
45001
45002
45003
45004
45005

Can someone help with how to create this report?




Replies:
Posted By: kevlray
Date Posted: 18 Feb 2021 at 4:23am
Formula with a  FOR LOOP putting data into an ARRAY?  I do not remember the syntax. I can work on it in a bit.


Posted By: kevlray
Date Posted: 18 Feb 2021 at 4:58am
Here is some sample code.  I do not know if this what you need to achieve.  Of course a parameter will have to be created (I called mine counter),

numbervar array values;
redim values[{?counter}];
numbervar initial := 40000;
numbervar i;
stringvar resultstr;
i:= 1;


while i <= {?counter}
do
    (
        initial  := initial + 1;
        values := initial;
        
            i:= i +1
    );
i:= 1;
while i <= {?counter}
do
    (
      resultstr := resultstr + chr(13) + cstr(values);
        i := i +1;
    );
right(resultstr, len(resultstr) -1)



Print Page | Close Window