Hi,
In one sequece, i need to print a report in the tabular format. we are using LS Retail with Navision. In that report i need tender type based invoice wise report. For this i have taken the tender type setup values(viz, cash, uticc,hsbcc,finance,creditsale etc.) in to one array. and the transaction wise details like payment type in one array i have taken. The report is showing the details. ex: If the first record has value of Rs.1000/- in cash and the second record has 2000/- as credit sale, in the report it showing 1000/- as cash in the first record and in the second record it is showing 1000/- as cash and 2000/- as credit sale both the values are showing. I tried to clear the variable. But it is not getting cleared. Hereunder i am pasting the code.
Transaction Header - OnAfterGetRecord()
Transpayment.RESET;
Transpayment.SETRANGE(Transpayment.“Receipt No.”,“Transaction Header”.“Receipt No.”);
CLEAR(Payment2);
WHILE Transpayment.NEXT<>0 DO
BEGIN
IF tender2[1]=Transpayment.“Tender Type” THEN
Payment2[1]:=Transpayment.“Amount Tendered”
ELSE IF tender2[2]=Transpayment.“Tender Type” THEN
Payment2[2]:=Transpayment.“Amount Tendered”
ELSE IF tender2[3]=Transpayment.“Tender Type” THEN
Payment2[3]:=Transpayment.“Amount Tendered”
ELSE IF tender2[4]=Transpayment.“Tender Type” THEN
Payment2[4]:=Transpayment.“Amount Tendered”
ELSE IF tender2[5]=Transpayment.“Tender Type” THEN
Payment2[5]:=Transpayment.“Amount Tendered”
ELSE IF tender2[6]=Transpayment.“Tender Type” THEN
Payment2[3]:=Transpayment.“Amount Tendered”
ELSE IF tender2[7]=Transpayment.“Tender Type” THEN
Payment2[7]:=Transpayment.“Amount Tendered”
ELSE IF tender2[8]=Transpayment.“Tender Type” THEN
Payment2[8]:=Transpayment.“Amount Tendered”
ELSE IF tender2[9]=Transpayment.“Tender Type” THEN
Payment2[9]:=Transpayment.“Amount Tendered”
ELSE IF tender2[10]=Transpayment.“Tender Type” THEN
Payment2[10]:=Transpayment.“Amount Tendered”
ELSE IF tender2[11]=Transpayment.“Tender Type” THEN
Payment2[11]:=Transpayment.“Amount Tendered”
ELSE IF tender2[12]=Transpayment.“Tender Type” THEN
Payment2[12]:=Transpayment.“Amount Tendered”
ELSE IF tender2[13]=Transpayment.“Tender Type” THEN
Payment2[13]:=Transpayment.“Amount Tendered”
ELSE IF tender2[14]=Transpayment.“Tender Type” THEN
Payment2[14]:=Transpayment.“Amount Tendered”
ELSE IF tender2[15]=Transpayment.“Tender Type” THEN
Payment2[15]:=Transpayment.“Amount Tendered”;
Receiptno:=“Transaction Header”.“Receipt No.”;
Transpayment.NEXT;
END;
The result is like this.
|
Cash
|
|
Standard Chartard CC
|
|
CityBank CC
|
|
Whirlpool Scrach Card
|
JNJ
|
|
ICICI Card
|
|
Gift Voucher
|
|
Finance
|
|
Credit Sale
|
|
Insitutional
|
|
UTI CC
|
|
HSBC CC
|
|
|
D0002
|
|
Digital Shoppy Raj Bhavan
|
|
02A8001796
|
01/06/08
|
|
CD0002-008233
|
|
-100.00
|
|
100.00
|
|
0.00
|
|
0.00
|
|
0.00
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
|
02A8001796
|
|
0.00
|
|
0.00
|
|
0.00
|
|
02A8001797
|
01/06/08
|
|
CD0002-008234
|
|
-17,000.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
17,000.00
|
|
0.00
|
|
|
02A8001797
|
|
0.00
|
|
0.00
|
|
0.00
|
|
02A8001798
|
01/06/08
|
|
CD0002-008235
|
|
-4,000.00
|
|
4,000.00
|
|
0.00
|
|
0.00
|
|
0.00
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
|
02A8001798
|
|
0.00
|
|
0.00
|
|
0.00
|
|
02A8001799
|
01/06/08
|
|
CD0002-008236
|
|
-14,500.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
14,500.00
|
|
0.00
|
|
|
02A8001799
|
|
0.00
|
|
0.00
|
|
0.00
|
|
02A8001800
|
01/06/08
|
|
CD0002-008237
|
|
-3,400.00
|
|
3,400.00
|
|
0.00
|
|
0.00
|
|
0.00
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
|
02A8001800
|
|
0.00
|
|
0.00
|
|
0.00
|
|
02A8001801
|
01/06/08
|
|
CD0002-008222
|
|
-24,990.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
5,000.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
|
02A8001801
|
|
0.00
|
|
0.00
|
|
0.00
|
|
02A8001802
|
01/06/08
|
|
CD0002-008222
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
|
02A8001802
|
|
0.00
|
|
0.00
|
|
0.00
|
|
02A8001803
|
01/06/08
|
|
CD0002-008238
|
|
-2,100.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
0.00
|
|
2,100.00
|
|
0.00
|
|
|
02A8001803
|
|
0.00
|
|
0.00
|
|
0.00
|
Even i have given the
Hi,
You could go through all the elements of the array and clear them individually or you could use CLEARALL (see below).
Form - OnOpenForm()
for i:=1 TO 75 do begin
testArr[i] := INCSTR('Array value '+format(i));
end;
FOR i:=1 to 100 do begin
message(testArr[i]);
END;
clearall;
FOR i:=1 to 100 do begin
//clear(testArr[i]);
message(‘Array ’ + format(i) + ’ value = %1’, testArr[i]);
END;
Hope this helps.
Be careful with a clearall as it clears all variables in your code except for record variables. This is pretty dangerous.
If you do clear(testArr) it will clear all values in your array.