Hi
In Array How to Add Value to the next of last Value . I have below code. I want if Account No not found n array then it should be appended to the array.
Below is he code on after get record
ctr := 1;
WHILE (Ctr <= 10) DO BEGIN IF AccountName[Ctr] = GLEntry."G/L Account No." THEN BEGIN AccountValue[Ctr] += GLEntry.Amount; found := TRUE; END; Ctr += 1; END;
Thanks
*This post is locked for comments
Hi
Resolved. Code was correct . In RDLC Last() was to be used.
Thanks
Which value you want to sum up and where? If want sum up then don't you need to write your code accordingly..
Debug the code and do appropriate changes.
Hi
IN the below code it is showing only values of first record. IT is not summing up if found
2L30 -8532
2L20 -8532
3A40 111864
0
0
WHILE (Ctr <= 10) DO BEGIN
IF AccountName[Ctr] = GLEntry."G/L Account No." THEN BEGIN
AccountValue[Ctr] += GLEntry.Amount;
found := TRUE;
END;
Ctr += 1;
END;
IF NOT found THEN BEGIN
AccountName[g_ctr] := GLEntry."G/L Account No.";
AccountValue[g_ctr] := GLEntry.Amount;
g_ctr += 1;
END;
Thanks
Hi
It is not working
Thanks
Hello,
You have to write something like:
OnPreReport()
G/L Entry - OnAfterGetRecord()
Ctr := 1;
WHILE (Ctr <= 10) DO BEGIN
IF AccountName[Ctr] = GLEntry."G/L Account No." THEN BEGIN
AccountValue[Ctr] += GLEntry.Amount;
END ELSE BEGIN
AccountName[Ctr] := GLEntry."G/L Account No.";
AccountValue[Ctr] := GLEntry.Amount;
END;
Ctr += 1;
END;
So now what is the issue with this code ? Are you not getting any value in array ?
Activate debugger and check where you can easily find the execution of program.
Hi
Below is the code. I am using only 1 Array . U know what actually i want.
OnPreReport() g_ctr := 1; G/L Entry - OnAfterGetRecord() Ctr := 1; WHILE (Ctr <= 10) DO BEGIN IF AccountName[Ctr] = GLEntry."G/L Account No." THEN BEGIN AccountValue[Ctr] += GLEntry.Amount; found := TRUE; END; Ctr += 1; END; IF NOT found THEN BEGIN AccountName[g_ctr] := GLEntry."G/L Account No."; AccountValue[g_ctr] := GLEntry.Amount; g_ctr += 1; END;
Thanks
Hello,
put some example, what you want, so we can easily understand ur query.
I think you want , if GLEntry."G/L Account No." is matched with AccountName[Ctr] then you are adding amount value, else you want to skip, If it so then just Re-write your code like:
ctr := 1;
WHILE (Ctr <= 10) DO BEGIN
IF AccountName[Ctr] = GLEntry."G/L Account No." THEN BEGIN
AccountValue[Ctr] += GLEntry.Amount;
found := TRUE;
Ctr += 1;
END;
END;
if it not fulfill ur requirement then post your whole code with some example.
Hi
In Array if Account no not found then i want to append in that array . If Found then i am adding Amount Value at that index.
Thanks
Do you want to put in same array or another array . You can put else condition and add the value in array.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156