Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Word count

Posted on by 5
Hi guys,
 
Is possible to show a word count field in business central ? 
Let says there is a field to show 0/100 in the field. When I have inputted 10 words, it will updated as 10/100. 
Is it possible for any coding solution >_< ?
 
Many thanks !!
Categories:
  • Suggested answer
    Judy Profile Picture
    Judy Microsoft Employee on at
    Word count
    Hi, you can use the Text.StrLen(Text) Method to get the length of a string you define.
     
    Best Regards,
    Judy
  • Suggested answer
    Shrey Chauhan Profile Picture
    Shrey Chauhan 288 on at
    Word count
    Hello,

    Here's the reference and code for the word count field in business central : 
     
     
    field(2; Name; Text[100])
            {
                Caption = 'Name';
                trigger OnValidate()
                var
                    Length: Integer;
                    MaxLength: Integer;
                begin
                    Length := StrLen(Rec.Name);
                    MaxLength := MaxStrLen(Rec.Name);
                    "Word Count" := Format(Length) + '/' + Format(MaxLength);
                end;
            }
    field(15; "Word Count"; Text[250])
            {
                DataClassification = ToBeClassified;
            }
     
    Hope this solution's help's.

    Thank you,
    Shrey Chauhan.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans