How do a Add a blank line to the end of my Requirement or Exception Text
How do a Add a blank line to the end of my Requirement or Exception Text
Currently I am adding a requirement to an order via an Automation Code Snippet. Next I read the requirement text from the newly added requirement. Next I replace some of the text in that requirement and use IOrderItem.SetProperty(order_requirement, 'Text', order_requirement_text) to update the text in the requirement. All of the text replacement works just fine. My question is, is there a way to add a blank line on the end of that text updated. I need a blank like to appear because I need a line between each requirement when publishing the Search Data Schedule. So how to a insert a blank line at the end of my requirement text and have it show up in my Search Data Schedule?
Re: How do a Add a blank line to the end of my Requirement or Exception Text
Requirements & Exceptions can be in 2 formats.
1. Plain Text where a /r/n appended to whatever text you are putting in there should add a blank line at the end of the requirement/exception. This is generally the format that will be used when setting the 'Text' property programmatically or via a lookup table.
2. RTF formatted text, with this format you need to add a /par right before the closing } of the rtf string. This is the format that is used if a user manipulates the text of the requirement/exception.
If this doesn't get you going, please post a snippet of your automation that isn't working and we can go from there.
1. Plain Text where a /r/n appended to whatever text you are putting in there should add a blank line at the end of the requirement/exception. This is generally the format that will be used when setting the 'Text' property programmatically or via a lookup table.
2. RTF formatted text, with this format you need to add a /par right before the closing } of the rtf string. This is the format that is used if a user manipulates the text of the requirement/exception.
If this doesn't get you going, please post a snippet of your automation that isn't working and we can go from there.
Vlad Mrvichin, Senior Software Developer, Custom Dev, SoftPro
Re: How do a Add a blank line to the end of my Requirement or Exception Text
This is my code snippet. It doesn't end with }, but it is RTF formated
import re
from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *
from SoftPro.OrderTracking.Client.Orders import *
# Constants
TARGET_LOOKUP_CODE = 'FLNoC1'
TARGET_CONTEXT = 'Requirement'
PROPERTY_STATES = ['FL']
PROPERTY_TYPES_CODE = ['Condo']
INSTRUMENT_NAME = 'Notice of Commencement'
NOTE_CATEGORY = '3' # CC EFLITE
# Order context
order = Context
def does_meet_criteria():
# Variables
property_state_exists = False
property_type_code_exists = False
note_exists = False
requirement_needs_adding = True
# Verify Property State
for property_ in order.Properties:
if property_.Address.State.Code in PROPERTY_STATES:
property_state_exists = True
break
if not property_state_exists: # Stop executing if criteria not met
return False
for property_ in order.Properties:
# Verify Property type code (Condo only)
if str(property_.Type) in PROPERTY_TYPES_CODE:
property_type_code_exists = True
break
if not property_type_code_exists: # Stop executing if criteria not met
return False
for note_ in order.Notes:
# Verify Category code (CC EFLITE only), Instrument Name (Notice of Commencement only), Additional Comments (NoC - Common only)
noteText = note_.Text
parcelOne = re.search('Parcel 1', noteText)
nTextSplit = noteText.split('Instrument Name')
categories = note_.Categories
isCategorie = False if not categories else any(map(lambda x: x == str(NOTE_CATEGORY), str(int(categories.replace(',', '')))))
if (len(nTextSplit) > 0 and parcelOne):
for nText in nTextSplit:
getNotice = nText.lower().partition('notice of commencement')[1]
if isCategorie and getNotice:
note_exists = True
break
if not note_exists: # Stop executing if criteria not met
return False # fix indent
# Check Requirements to see if it already exists
requirements = order.Title.TitleInsuranceCalculations[0].Commitment.Requirements
for requirement in requirements:
if str(requirement).upper() == TARGET_LOOKUP_CODE.upper():
requirement_needs_adding = False
break
# Returns False if criteria not met, otherwise, return True
return requirement_needs_adding
# If order doesn't have the target requirement, create it.
if does_meet_criteria():
try:
order_requirement_add_text = ''
book_previous_result = ''
page_previous_result = ''
doc_previous_result = ''
show_once = 1
duplicate_note = []
for note_ in order.Notes:
noteText = note_.Text
parcelOne = re.search('Parcel 1', noteText)
nTextSplit = noteText.split('Instrument Name')
categories = note_.Categories
isCategorie = False if not categories else any(map(lambda x: x == str(NOTE_CATEGORY), str(int(categories.replace(',', '')))))
if (len(nTextSplit) > 0 and parcelOne):
for nText in nTextSplit:
getNotice = nText.lower().partition('notice of commencement')[1]
if isCategorie and getNotice:
book = nText.partition('Book/Liber: ')[2]
page = nText.partition('Page: ')[2]
book_start = 'Book/Liber:'
end = '\n'
book_result = re.search('%s(.*?)%s' % (book_start, end), nText).group(1).strip()
page_start = 'Page:'
end = '\n'
page_result = re.search('%s(.*?)%s' % (page_start, end), nText).group(1).strip()
doc_start = 'Doc No./Instr No.:'
end = '\n'
doc_result = re.search('%s(.*?)%s' % (doc_start, end), nText).group(1).strip()
date_start = 'Recorded Date:'
end = '\n'
date_result = re.search('%s(.*?)%s' % (date_start, end), nText).group(1).strip()
new_note = {"book": book_result, "page": page_result, "doc": doc_result}
is_bookpage_duplicate = any(note.get("book") == new_note.get("book") and note.get("page") == new_note.get("page") for note in duplicate_note)
is_doc_duplicate = any(note.get("doc") == new_note.get("doc") for note in duplicate_note)
is_allempty_duplicate = any(entry.get("book") == new_note.get("book") and entry.get("page") == new_note.get("page") and entry.get("doc") == new_note.get("doc") for entry in duplicate_note)
if ((book_result or page_result) and not is_bookpage_duplicate):
# Create an instance of a requirement.
requirement = IOrder.CreateNew(order, TARGET_CONTEXT)
requirement.Code = TARGET_LOOKUP_CODE
# Add the new requirement to the list of all requirements.
order_commitment_requirements = order.Title.TitleInsuranceCalculations[0].Commitment.Requirements
order_commitment_requirements.Add(requirement)
last_index = len(order_commitment_requirements) - 1
order_requirement = order_commitment_requirements[last_index]
order_requirement_text = IOrderItem.GetProperty(order_requirement, 'Text')
order_requirement_text = order_requirement_text.replace('\{\{Order.ExistingLiens[1].Recording.RecordedDate\}\}', date_result.strip() if date_result.strip() else '')
order_requirement_text = order_requirement_text.replace('\{\{Order.ExistingLiens[1].Recording.BookNumber\}\}', book_result.strip() if book_result.strip() else '')
order_requirement_text = order_requirement_text.replace('\{\{Order.ExistingLiens[1].Recording.PageNumber\}\} or Instrument Number \{\{Order.ExistingLiens[1].Recording.DocumentNumber\}\}', page_result.strip() if page_result.strip() else '')
order_requirement_text = order_requirement_text.replace('\{\{Order.Properties[1].County\}\}', order.Properties[0].County.strip() + ' ' if order.Properties[0].County else '')
book_previous_result = book_result
page_previous_result = page_result
duplicate_note.append(new_note)
IOrderItem.SetProperty(order_requirement, 'Text', order_requirement_text)
elif (doc_result and not (book_result or page_result) and not is_doc_duplicate):
# Create an instance of a requirement.
requirement = IOrder.CreateNew(order, TARGET_CONTEXT)
requirement.Code = TARGET_LOOKUP_CODE
# Add the new requirement to the list of all requirements.
order_commitment_requirements = order.Title.TitleInsuranceCalculations[0].Commitment.Requirements
order_commitment_requirements.Add(requirement)
last_index = len(order_commitment_requirements) - 1
order_requirement = order_commitment_requirements[last_index]
order_requirement_text = IOrderItem.GetProperty(order_requirement, 'Text')
order_requirement_text = order_requirement_text.replace('\{\{Order.ExistingLiens[1].Recording.RecordedDate\}\}', date_result.strip() if date_result.strip() else '')
order_requirement_text = order_requirement_text.replace('\{\{Order.Properties[1].County\}\}', order.Properties[0].County.strip() + ' ' if order.Properties[0].County else '')
order_requirement_text = order_requirement_text.replace('Book \{\{Order.ExistingLiens[1].Recording.BookNumber\}\}, Page \{\{Order.ExistingLiens[1].Recording.PageNumber\}\} or Instrument Number \{\{Order.ExistingLiens[1].Recording.DocumentNumber\}\}', 'Instrument Number ' + doc_result.strip() if doc_result else '')
doc_previous_result = doc_result
duplicate_note.append(new_note)
IOrderItem.SetProperty(order_requirement, 'Text', order_requirement_text)
elif ((not(book_result and page_result and doc_result) and show_once == 1 and is_allempty_duplicate)):
# Create an instance of a requirement.
requirement = IOrder.CreateNew(order, TARGET_CONTEXT)
requirement.Code = TARGET_LOOKUP_CODE
# Add the new requirement to the list of all requirements.
order_commitment_requirements = order.Title.TitleInsuranceCalculations[0].Commitment.Requirements
order_commitment_requirements.Add(requirement)
last_index = len(order_commitment_requirements) - 1
order_requirement = order_commitment_requirements[last_index]
order_requirement_text = IOrderItem.GetProperty(order_requirement, 'Text')
order_requirement_text = order_requirement_text.replace('\{\{Order.ExistingLiens[1].Recording.RecordedDate\}\}', date_result.strip() if date_result.strip() else '')
order_requirement_text = order_requirement_text.replace('\{\{Order.ExistingLiens[1].Recording.BookNumber\}\}', '')
order_requirement_text = order_requirement_text.replace('\{\{Order.ExistingLiens[1].Recording.PageNumber\}\}', '')
order_requirement_text = order_requirement_text.replace('\{\{Order.Properties[1].County\}\}', order.Properties[0].County.strip() + ' ' if order.Properties[0].County else '')
order_requirement_text = order_requirement_text.replace('\{\{Order.ExistingLiens[1].Recording.DocumentNumber\}\}', '')
IOrderItem.SetProperty(order_requirement, 'Text', order_requirement_text)
show_once = show_once + 1
except:
raise ValueError("Underwriter review required - could not add '" + TARGET_LOOKUP_CODE + "' " + TARGET_CONTEXT)
Below is the rule Text to be manipulated. Am I able to add \par right after the period or do I have use brackets to get it to work with RTF?
import re
from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *
from SoftPro.OrderTracking.Client.Orders import *
# Constants
TARGET_LOOKUP_CODE = 'FLNoC1'
TARGET_CONTEXT = 'Requirement'
PROPERTY_STATES = ['FL']
PROPERTY_TYPES_CODE = ['Condo']
INSTRUMENT_NAME = 'Notice of Commencement'
NOTE_CATEGORY = '3' # CC EFLITE
# Order context
order = Context
def does_meet_criteria():
# Variables
property_state_exists = False
property_type_code_exists = False
note_exists = False
requirement_needs_adding = True
# Verify Property State
for property_ in order.Properties:
if property_.Address.State.Code in PROPERTY_STATES:
property_state_exists = True
break
if not property_state_exists: # Stop executing if criteria not met
return False
for property_ in order.Properties:
# Verify Property type code (Condo only)
if str(property_.Type) in PROPERTY_TYPES_CODE:
property_type_code_exists = True
break
if not property_type_code_exists: # Stop executing if criteria not met
return False
for note_ in order.Notes:
# Verify Category code (CC EFLITE only), Instrument Name (Notice of Commencement only), Additional Comments (NoC - Common only)
noteText = note_.Text
parcelOne = re.search('Parcel 1', noteText)
nTextSplit = noteText.split('Instrument Name')
categories = note_.Categories
isCategorie = False if not categories else any(map(lambda x: x == str(NOTE_CATEGORY), str(int(categories.replace(',', '')))))
if (len(nTextSplit) > 0 and parcelOne):
for nText in nTextSplit:
getNotice = nText.lower().partition('notice of commencement')[1]
if isCategorie and getNotice:
note_exists = True
break
if not note_exists: # Stop executing if criteria not met
return False # fix indent
# Check Requirements to see if it already exists
requirements = order.Title.TitleInsuranceCalculations[0].Commitment.Requirements
for requirement in requirements:
if str(requirement).upper() == TARGET_LOOKUP_CODE.upper():
requirement_needs_adding = False
break
# Returns False if criteria not met, otherwise, return True
return requirement_needs_adding
# If order doesn't have the target requirement, create it.
if does_meet_criteria():
try:
order_requirement_add_text = ''
book_previous_result = ''
page_previous_result = ''
doc_previous_result = ''
show_once = 1
duplicate_note = []
for note_ in order.Notes:
noteText = note_.Text
parcelOne = re.search('Parcel 1', noteText)
nTextSplit = noteText.split('Instrument Name')
categories = note_.Categories
isCategorie = False if not categories else any(map(lambda x: x == str(NOTE_CATEGORY), str(int(categories.replace(',', '')))))
if (len(nTextSplit) > 0 and parcelOne):
for nText in nTextSplit:
getNotice = nText.lower().partition('notice of commencement')[1]
if isCategorie and getNotice:
book = nText.partition('Book/Liber: ')[2]
page = nText.partition('Page: ')[2]
book_start = 'Book/Liber:'
end = '\n'
book_result = re.search('%s(.*?)%s' % (book_start, end), nText).group(1).strip()
page_start = 'Page:'
end = '\n'
page_result = re.search('%s(.*?)%s' % (page_start, end), nText).group(1).strip()
doc_start = 'Doc No./Instr No.:'
end = '\n'
doc_result = re.search('%s(.*?)%s' % (doc_start, end), nText).group(1).strip()
date_start = 'Recorded Date:'
end = '\n'
date_result = re.search('%s(.*?)%s' % (date_start, end), nText).group(1).strip()
new_note = {"book": book_result, "page": page_result, "doc": doc_result}
is_bookpage_duplicate = any(note.get("book") == new_note.get("book") and note.get("page") == new_note.get("page") for note in duplicate_note)
is_doc_duplicate = any(note.get("doc") == new_note.get("doc") for note in duplicate_note)
is_allempty_duplicate = any(entry.get("book") == new_note.get("book") and entry.get("page") == new_note.get("page") and entry.get("doc") == new_note.get("doc") for entry in duplicate_note)
if ((book_result or page_result) and not is_bookpage_duplicate):
# Create an instance of a requirement.
requirement = IOrder.CreateNew(order, TARGET_CONTEXT)
requirement.Code = TARGET_LOOKUP_CODE
# Add the new requirement to the list of all requirements.
order_commitment_requirements = order.Title.TitleInsuranceCalculations[0].Commitment.Requirements
order_commitment_requirements.Add(requirement)
last_index = len(order_commitment_requirements) - 1
order_requirement = order_commitment_requirements[last_index]
order_requirement_text = IOrderItem.GetProperty(order_requirement, 'Text')
order_requirement_text = order_requirement_text.replace('\{\{Order.ExistingLiens[1].Recording.RecordedDate\}\}', date_result.strip() if date_result.strip() else '')
order_requirement_text = order_requirement_text.replace('\{\{Order.ExistingLiens[1].Recording.BookNumber\}\}', book_result.strip() if book_result.strip() else '')
order_requirement_text = order_requirement_text.replace('\{\{Order.ExistingLiens[1].Recording.PageNumber\}\} or Instrument Number \{\{Order.ExistingLiens[1].Recording.DocumentNumber\}\}', page_result.strip() if page_result.strip() else '')
order_requirement_text = order_requirement_text.replace('\{\{Order.Properties[1].County\}\}', order.Properties[0].County.strip() + ' ' if order.Properties[0].County else '')
book_previous_result = book_result
page_previous_result = page_result
duplicate_note.append(new_note)
IOrderItem.SetProperty(order_requirement, 'Text', order_requirement_text)
elif (doc_result and not (book_result or page_result) and not is_doc_duplicate):
# Create an instance of a requirement.
requirement = IOrder.CreateNew(order, TARGET_CONTEXT)
requirement.Code = TARGET_LOOKUP_CODE
# Add the new requirement to the list of all requirements.
order_commitment_requirements = order.Title.TitleInsuranceCalculations[0].Commitment.Requirements
order_commitment_requirements.Add(requirement)
last_index = len(order_commitment_requirements) - 1
order_requirement = order_commitment_requirements[last_index]
order_requirement_text = IOrderItem.GetProperty(order_requirement, 'Text')
order_requirement_text = order_requirement_text.replace('\{\{Order.ExistingLiens[1].Recording.RecordedDate\}\}', date_result.strip() if date_result.strip() else '')
order_requirement_text = order_requirement_text.replace('\{\{Order.Properties[1].County\}\}', order.Properties[0].County.strip() + ' ' if order.Properties[0].County else '')
order_requirement_text = order_requirement_text.replace('Book \{\{Order.ExistingLiens[1].Recording.BookNumber\}\}, Page \{\{Order.ExistingLiens[1].Recording.PageNumber\}\} or Instrument Number \{\{Order.ExistingLiens[1].Recording.DocumentNumber\}\}', 'Instrument Number ' + doc_result.strip() if doc_result else '')
doc_previous_result = doc_result
duplicate_note.append(new_note)
IOrderItem.SetProperty(order_requirement, 'Text', order_requirement_text)
elif ((not(book_result and page_result and doc_result) and show_once == 1 and is_allempty_duplicate)):
# Create an instance of a requirement.
requirement = IOrder.CreateNew(order, TARGET_CONTEXT)
requirement.Code = TARGET_LOOKUP_CODE
# Add the new requirement to the list of all requirements.
order_commitment_requirements = order.Title.TitleInsuranceCalculations[0].Commitment.Requirements
order_commitment_requirements.Add(requirement)
last_index = len(order_commitment_requirements) - 1
order_requirement = order_commitment_requirements[last_index]
order_requirement_text = IOrderItem.GetProperty(order_requirement, 'Text')
order_requirement_text = order_requirement_text.replace('\{\{Order.ExistingLiens[1].Recording.RecordedDate\}\}', date_result.strip() if date_result.strip() else '')
order_requirement_text = order_requirement_text.replace('\{\{Order.ExistingLiens[1].Recording.BookNumber\}\}', '')
order_requirement_text = order_requirement_text.replace('\{\{Order.ExistingLiens[1].Recording.PageNumber\}\}', '')
order_requirement_text = order_requirement_text.replace('\{\{Order.Properties[1].County\}\}', order.Properties[0].County.strip() + ' ' if order.Properties[0].County else '')
order_requirement_text = order_requirement_text.replace('\{\{Order.ExistingLiens[1].Recording.DocumentNumber\}\}', '')
IOrderItem.SetProperty(order_requirement, 'Text', order_requirement_text)
show_once = show_once + 1
except:
raise ValueError("Underwriter review required - could not add '" + TARGET_LOOKUP_CODE + "' " + TARGET_CONTEXT)
Below is the rule Text to be manipulated. Am I able to add \par right after the period or do I have use brackets to get it to work with RTF?
Re: How do a Add a blank line to the end of my Requirement or Exception Text
The code you provided is far too complex for me to try and get setup in my environment, I'll need you to condense it down into just a small snippet that demonstrates the problem that I can quickly and easily get set up on my system. Also, please put the code contents within a code block by pressing the following key
From briefly scanning over that code, it looks like you are pulling the data in via a lookup table, which would mean it's not RTF, so the /r/n should work. Regardless one of those 2 suggestions (either /r/n or /par) should work, have you tried either of those and if so what were the results?
that can be found in the "Post a reply" toolbar.From briefly scanning over that code, it looks like you are pulling the data in via a lookup table, which would mean it's not RTF, so the /r/n should work. Regardless one of those 2 suggestions (either /r/n or /par) should work, have you tried either of those and if so what were the results?
Vlad Mrvichin, Senior Software Developer, Custom Dev, SoftPro
Re: How do a Add a blank line to the end of my Requirement or Exception Text
Turns out the requirement was in RTF format. Splitting the text caused us to loose the closing RTF tag \par}
Once that was added everything was spaced properly. Thanks for the help.
Once that was added everything was spaced properly. Thanks for the help.