chuckyfiche
IS-IT--Management
Well, I'm sorry to say I'm back once again with a report/array that still does not work. I can only find small blocks of time to work on this problem thus the lenght between posts.
Everyone has been very helpful with this block of code. The problem I seem to be having now, is the array is building, but only counting once then resetting.
Thus, the running total works for two parts in a row, then goes back to the original @available quantity.
I've removed all other tables, groups and paramaters. I've built three standard parts, put in quantities and created three orders as a sample to verify the script. I really can't see why it doesn't work.
The only 'glitch' and reason I feel there could be a problem with the script - is it needs the sCounter variable set in the header or Crystal reports a problem with the subscript needing to be between 1 and the size of the array.
Crystal 8.5; SQL Server.
I've tried removing the counter and changing the code to a redim preserve array [ubound(array)+1];
I've also changed the while to a for loop.
Same results all around.
List should look like this:
Part On Order Available Balance
1 50 100 50
2 25 30 5
1 40 50 10
2 5 5 0
I know the on-order column; the available and balance need to be calculated with the array;
Thank you all for any help on this seemingly impossible problem.
>>>>>>>>>>>>@AVAILABLE_QTY<<<<<<<<<<<<<<<< {PART.QTY_ON_HAND} - {CUST_ORDER_LINE.ORDER_QTY}
>>>>>>>>>>>
Everyone has been very helpful with this block of code. The problem I seem to be having now, is the array is building, but only counting once then resetting.
Thus, the running total works for two parts in a row, then goes back to the original @available quantity.
I've removed all other tables, groups and paramaters. I've built three standard parts, put in quantities and created three orders as a sample to verify the script. I really can't see why it doesn't work.
The only 'glitch' and reason I feel there could be a problem with the script - is it needs the sCounter variable set in the header or Crystal reports a problem with the subscript needing to be between 1 and the size of the array.
Crystal 8.5; SQL Server.
I've tried removing the counter and changing the code to a redim preserve array [ubound(array)+1];
I've also changed the while to a for loop.
Same results all around.
List should look like this:
Part On Order Available Balance
1 50 100 50
2 25 30 5
1 40 50 10
2 5 5 0
I know the on-order column; the available and balance need to be calculated with the array;
Thank you all for any help on this seemingly impossible problem.
>>>>>>>>>>>>@AVAILABLE_QTY<<<<<<<<<<<<<<<< {PART.QTY_ON_HAND} - {CUST_ORDER_LINE.ORDER_QTY}
>>>>>>>>>>>
Code:
evaluateafter({@AVAILABLE_QTY});
stringvar array PART_Array;
numbervar array Qty_Array;
numbervar NewQty;
numbervar max;
numbervar sCounter :=0;
Booleanvar Flag;
if not({CUST_ORDER_LINE.PART_ID} in PART_Array )then
(
sCounter := sCounter +1;
Redim Preserve PART_Array[sCounter];
Redim Preserve Qty_Array[sCounter];
PART_Array[sCounter] := {CUST_ORDER_LINE.PART_ID};
NewQty := {@AVAILABLE_QTY};
QTY_Array[sCounter] := NewQty;
Flag := False;
)
else
(
max := ubound(PART_Array);
While sCounter <= max and Flag = false do
(
sCounter := sCounter+1;
if{CUST_ORDER_LINE.PART_ID} = PART_Array[sCounter] then
(
NewQty := QTY_Array[sCounter] - {CUST_ORDER_LINE.ORDER_QTY};
QTY_Array[sCounter] := NewQty;
Flag := True;
);
);
);
NewQty;