web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Fixing Bank Details RDLC Alignment

(3) ShareShare
ReportReport
Posted on by 10

Hi all,

I have a problem in business central al programming, where i want all the bank name and bank account no. to show as a block and start from the same position. I will send the photos so you could see it better The fist photo is how the textboxes are in the rdlc layout, how the bank details are currently shown and the third is how i want them to show. The bank names number may vare depending on the invoice, it can be 3 banks or more or less. The bank name field is Text[100] but usually there are no invoices that have bank account with this much of characters, maybe max 50 characters. The bank names characters may vary from bank to bank. and the bank account no. is Text[30], but usually is 16 characters or 20. The BankAccountRec referes to the  Record "Bank Account"

Here is my current code, that it might be wrong but to get an idea. In the RDLC report layout i have added the Bank Name and Account No. in two different textboxes:

        BankAccountRec.SetFilter("Bank Account No.", '<>%1', '');
        if BankAccountRec.FindSet() then
            repeat
                BankName += BankAccountRec.Name + CopyStr(' ', 1, MaxStrLen(BankAccountRec.Name));
                AccountNo += BankAccountRec."Bank Account No." + CopyStr(' ', 1, MaxStrLen(BankAccountRec."Bank Account No."));
            until BankAccountRec.Next() = 0;
    end;
hOW i WANT THEM TO SHOW.png
HOW THEY ARE SHOWN .png
Rdlc textboxes.png
  • Suggested answer
    YUN ZHU Profile Picture
    103,702 Super User 2026 Season 2 on at

    Since you are already using RDLC, simply align the text boxes first, and then left-align them all together.

    Alternatively, following the standard approach, you can create a table and insert your fields into the rows; this also allows for automatic alignment.

     

  • CU21081329-4 Profile Picture
    10 on at

    Well the text left-alignment did not work and i cannot put them in a table as i have them positioned in the report's footer, and in the footer section you cannot insert a table.

  • Suggested answer
    OussamaSabbouh Profile Picture
    20,172 Super User 2026 Season 2 on at

    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

  • Verified answer
    Grigorios Mavrogeorgis Profile Picture
    3,666 Super User 2026 Season 2 on at

    Hi, padding with spaces won't work here. CopyStr on one space returns only one space, PadStr is the function for that. But even then it won't line up, the report font is proportional, every letter has different width.

    I'd not concatenate in AL at all. Send the banks as rows, Bank Account as its own dataitem with name, account no. and a counter column 1, 2, 3. In RDLC use a matrix, column group on (counter - 1) Mod 4 and row group on Ceiling(counter / 4). Two textboxes in the cell, name on top, account below. You get 4 banks per row, all starting on same position, and it wraps alone.

    Just fix the cell width, otherwise a long bank name pushes the columns.

    Glad to help - follow up if anything is unclear.   

    ►  If this solved it, marking it verified helps others too.       

    Regards,
    Grigorios Mavrogeorgis
    Business Central Consultant & AL Developer

    Work: Gmsoft Limited
    Blog:  insidebusinesscentral
    LinkedIn: linkedin.com/in/gregorymavrogeorgis

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 765 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 571 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 299 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans