Using the below code to trim the character count and limit the characters below 65000 in a paragraph as the character count in the interface is different from the character count when we paste the same in the word document.please suggest changes and attached the screenshot of interface count and character count
if( local!isEdit, a!paragraphField( value: fv!item.body, saveInto: fv!item.body, characterLimit: 65000, showCharacterCount: true, height: "TALL", validations: if( len(fn!trim( fn!substitute( fv!item.body, char(10)," ") ) ) > 65000, "The communication you are trying to send exceeds the character limit allowed. Please send a modified version of the letter to not exceed [65000]", null )
Discussion posts and replies are publicly visible
Is there a specific reason to add a separate validation to check the length? This is already handled by that field.
In my experience, using any sorts of "office" software as a reference for anything related technical is a bad idea. Did you try to copy that text into a real text editor and let that count the characters?
@stefanHelzle
yes,for used validation as it needs to generate error message if it crosses 65000 and
its the same count in other text editors as well.
Are you aware that defining the characterLimit parameter will automatically do this kind of validation for you?
What do you mean with "its the same count in other text editors as well."? Same, compared to what?
yes I know that and we need to get a validation message as per the requirement and I am not asking about validation ,I want regarding the word count difference
same compared in word pad and notepad++
You modify the text before measuring the length. Maybe you revert that to just len(fv!item.body) and check again.
I have used the same logic as well shown below but still its showing different
if( local!isEdit, a!paragraphField( value: fv!item.body, saveInto: fv!item.body, characterLimit: 65000, showCharacterCount: true, height: "TALL", validations: if( len(fv!item.body) >= 65000, "The communication you are trying to send exceeds the character limit allowed. Please send a modified version of the letter to not exceed [65000]", null )
The only thing that comes to mind that may explain your issue is that certain characters count as 2 bytes instead of 1. characterCount will take this into account but len does not.
a!localVariables( local!value, a!textField( value: local!value, saveInto: local!value, characterLimit: 5, validations: concat(len(local!value), " characters", "") ) )
not able to get desired output
When the user enters a smiley, this can even be 4 bytes. BTW, there is the function lenb() which counts on a byte level.
used lenb but still getting same character count
Well, then this is an "issue" that has no real solution. I also have my doubts that this becomes an issue in real live when people enter text. And, I am sorry in case this sounds a bit ignorant. Is just like with email where everybody thinks that email is simple, and is surprised into what a dark and deep rabbit hole you fall when looking at the details.
is there no solution for this?
I was just checking some conversations around notepad++. There is also a controversy around which characters to include when counting. To answer your question, I do not see a "solution" to that "issue".