Hello,
The problem is the approach of concatenating the bank values with spaces. MaxStrLen(BankAccountRec.Name) returns the maximum field length, not the length of the current bank name, and even calculating the spaces differently wouldn't reliably align the values because RDLC normally uses proportional fonts. I would let the dataset return one record per bank and let RDLC handle the positioning.
For example, add the Bank Account as a dataitem and expose an index:
dataitem(BankAccount; "Bank Account")
{
DataItemTableView = sorting("No.")
where("Bank Account No." = filter(<> ''));
column(BankIndex; BankIndex)
{
}
column(BankName; Name)
{
}
column(BankAccountNo; "Bank Account No.")
{
}
trigger OnPreDataItem()
begin
BankIndex := 0;
end;
trigger OnAfterGetRecord()
begin
BankIndex += 1;
end;
}
Then in RDLC use a Matrix/Tablix, rather than the two large textboxes you currently have. If you want three banks per row, create a row group with:
=Ceiling(Fields!BankIndex.Value / 3)
and a column group with:
=(Fields!BankIndex.Value - 1) Mod 3
Inside each matrix cell, put BankName on the first row and BankAccountNo on the second row. Give each matrix column the same fixed width and set CanGrow = True. This gives you exactly the block-style layout from your desired screenshot:
BANK TEST1 Banka TEST2 BANK TEST3
0001 EU000000000001 EU000000000001
BANK TEST4 ...
...
If you want four banks per row instead, simply replace 3 with 4 in both expressions. This is much more reliable than adding spaces, tabs, or calculating string lengths, and it automatically handles different bank-name/account-number lengths and a varying number of banks.
Regards,
Oussama Sabbouh