Character Count

Discussions related to ReadyDoc development.
Post Reply
DanAtMPL
Posts: 13
Joined: Thu Jan 24, 2019 4:58 pm

Character Count

Post by DanAtMPL » Tue Mar 09, 2021 7:56 pm

I'm trying to have a custom Deed, as a Word-based ReadyDoc, check the character length of the "Order.Properties.EscrowLegal.Description" field, and if the length is greater than a certain amount, say 400 characters, then it will print the words "See attached Exhibit A", and then later in the document, it would check the same thing, and if it's longer than the set amount, it would actually print the full legal description.

I may be barking up the wrong tree, but when I was searching/poking around, I found that in the F8 calculation screen, when clicking the Sigma drop-down button, there's a command (or whatever) called "StrLen" which would seem to indicate "String Length", which would be exactly what I'm looking for. However, maybe I'm not using it correctly or something, because it only returns 0 or False.

Here's the relevant section of code that's going on (I whittled down the entire document to just this part, for testing purposes):

Code: Select all

<COMMENT>PC{{Order.Properties}}</COMMENT>
<VAR $LongLegal (0)>

WITNESSETH, that the Grantor does sell unto the Grantee the following property:
Value1 of LongLegal is: {{$LongLegal}} <COMMENT>Show the current value</COMMENT>

<CALC ({{$LongLegal}}, {{$LongLegal}} + StrLen({{.EscrowLegal.Description}}))>
Value2 of LongLegal is: {{$LongLegal}} <COMMENT>Show the current value</COMMENT>

<IF ({{$LongLegal}}>400)>See attached Exhibit A<ELSE>LEGAL GOES HERE</IF>

<CALC ({{$LongLegal}} = {{$LongLegal}} + StrLen({{.EscrowLegal.Description}}))>
Value3 of LongLegal is: {{$LongLegal}} <COMMENT>Show the current value</COMMENT>

(this is where the page break goes) <COMMENT>for reference</COMMENT>

<IF ({{$LongLegal}}>400)>
{{.Escrow.LegalDescription}}</IF>
And here's what it's putting out:

Code: Select all

WITNESSETH, that the Grantor does sell unto the Grantee the following property:
Value1 of LongLegal is: 0 

Value2 of LongLegal is: 0 
LEGAL GOES HERE
False
Value3 of LongLegal is: 0 
(this is where the page break goes) 
The legal description of my test file is (according to an online character count tool) 505 characters, including 79 spaces.

Anyone have any ideas? Is "StrLen" a tool for calculating or determining the number of characters in a string? If not, is there another way to do this? If so, am I simply calling it incorrectly?

BobRichards
Posts: 1116
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Character Count

Post by BobRichards » Wed Mar 10, 2021 5:02 pm

One of our WorkDoc devs looked at the code. He said you are exactly right about the "StrLen" function. However you need to fix the "if" statement.

Original:

Code: Select all

<IF ({{$LongLegal}}>400)>See attached Exhibit A<ELSE>LEGAL GOES HERE</IF>
Corrected value:

Code: Select all

<IF (StrLen({{.EscrowLegal.Description}})>400)>See Attached Exhibit A<ELSE>{{.EscrowLegal.Description}}</IF>
Bob Richards, Senior Software Developer, SoftPro

DanAtMPL
Posts: 13
Joined: Thu Jan 24, 2019 4:58 pm

Re: Character Count

Post by DanAtMPL » Wed Mar 10, 2021 7:24 pm

Thank you very much. That worked beautifully. I don't know why I thought I had to set it as another variable or something, but.. Anyways. Thank you.

Post Reply