Hi,
Newbie to the forum as well as to Crystal I need help with what I guess is an easy question (and yes, I have tried searching the forum...).
My problem is that I have a list of string values in which there is a contiued series number - String looks like this:
XX-<serialnumber>-YY
XX-<serialnumber+1>-YY
XX-<serialnumber+n>-YY
Some of the values might accidentaly have been deleted, and my job is now to find and publish the "holes in the list of values". Since there might be more than one conseqtive deleted value in a row, I somehow have to loop through all missing values and also somehow publish these.
I have so far come up with this (that isn't very pretty)... in which I thought I could send a "print" command in the while loop to add the missing value:
<code>
StringVar s_ExcNo;
NumberVar n_numFirst;
NumberVar n_increaser;
StringVar s_nextValue;
NumberVar n_numSecond;
NumberVar n_numDiff;
StringVar s_Result := "";
// Start by emptying the increaser of possible junkvalues
n_increaser := 0;
// Get the numbers out of the String
s_ExcNo := Mid({MyView.MyString}, 4, 5);
n_numFirst := ToNumber (s_ExcNo);
n_increaser := n_numFirst;
// Get the next number
s_nextValue := Next({MyView.MyString});
s_nextValue := Mid(s_nextValue, 4, 5);
n_numSecond := ToNumber(s_nextValue);
// Decrease the second (NEXT) -value
n_numSecond := n_numSecond-1;
// Populate the difference variable with the number consecutive missing values
n_numDiff := n_numSecond - n_numFirst;
// Check if the second number is equal to the first
If(n_numSecond = n_numFirst) THEN (
"0" // Will be suppressed an not displayed in the report
)
Else (
// Loop whilst n_numDiff isn't '0'
While n_numdiff > 0
Do (
// Decrease the condition value
n_numdiff := n_numDiff-1;
// increase the increaser value by 1, n_numdiff times
n_increaser := n_increaser + 1;
// Put the resultstring together
s_Result := s_Result & n_increaser & ", ";
// NOW UGLY CONCATENATING TO SHOW THE RESULT
// HERE I INSTEAD WOULD LIKE TO ADD A NEW ROW WITH THE RESULTSTRING TO THE REPORT
);
s_Result
)
</code>
I guess there are more simple and easier ways to to this... as you see - I need help!

Regards,
Dake