• Welcome to AppraisersForum.com, the premier online  community for the discussion of real estate appraisal. Register a free account to be able to post and unlock additional forums and features.

Script for Appraise-It

Appraisal Solutions

Sophomore Member
Joined
Jul 24, 2007
Professional Status
Certified Residential Appraiser
State
New York
I've been fooling around with Appraise-It and really like it because of the API. I thought i'd try and re-vive this thread.
Below is a script I tortured ChatGPT to develop as more of a "proof of concept" for greater things. I thought it may be handy whenever one has to write about gross/net adjustments. It generates an addendum page with a summary of each comparable's gross/net adjustments along with the largest adjustments etc. I usually just click under it and add commentary. Like I said, this script is/was a "proof of concept" to greater things, but I thought i'd pass it along because it demonstrates a number of things and will get you started in programmatically interacting with Appraise-It if you are so inclined. Feel free to modify, add etc. There are obviously lots of things you could do to make it more interesting and useful. Just copy the below code to a text file (notebook) save it as "Whatever.LUA" (I call it "Gross-Net Addendum Generator.LUA) and put it in your My Appraise-It\Data\Scripts folder so you can access it via the tool---> scripts menu.

Use at your own risk. I've only tested it on completed appraisals. There isn't much error handling for blanks etc. The function to figure out the largest adjustment seemed necessary. If I tried to get any fancier, it just wouldn't work but that's probably my lack of experience.

-- Script Begin
-- Format text from the report data.
local format = "\nComparable #%d:\n%s\n%s\nSale Price Amount: %s\nNet adjustments: %s\nGross adjustments: %s\nGross Living Area Adjustment: %s\nLargest adjustment(s): %s\n"

-- Replace 'YourComparableType' with the actual comparable type you want to work with
local comparableType = 'SalesComparables'

-- Variable to store the combined text
local combinedText = ""

-- Manual Function to figure out the largest adjustment (absolute value)
function largestAdjustments(compIndex)
-- Get fields into variables
local adjustments = {
SaleConcessionsAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "SaleConcessionsAdjustment").Text) or 0,
FinancingConcessionsAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "FinancingConcessionsAdjustment").Text) or 0,
SaleDateAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "SaleDateAdjustment").Text) or 0,
LocationAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "LocationAdjustment").Text) or 0,
PropertyRightsAppraisedAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "PropertyRightsAppraisedAdjustment").Text) or 0,
SiteAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "SiteAdjustment").Text) or 0,
ViewAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "ViewAdjustment").Text) or 0,
DesignStyleAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "DesignStyleAdjustment").Text) or 0,
ConstructionQualityAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "ConstructionQualityAdjustment").Text) or 0,
ActualAgeAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "ActualAgeAdjustment").Text) or 0,
ConditionAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "ConditionAdjustment").Text) or 0,
AboveGradeAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "AboveGradeAdjustment").Text) or 0,
RoomCountAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "RoomCountAdjustment").Text) or 0,
GrossLivingAreaAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "GrossLivingAreaAdjustment").Text) or 0,
BasementAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "BasementAdjustment").Text) or 0,
RoomsBelowGradeAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "RoomsBelowGradeAdjustment").Text) or 0,
FunctionalUtilityAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "FunctionalUtilityAdjustment").Text) or 0,
HeatingCoolingAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "HeatingCoolingAdjustment").Text) or 0,
EnergyEfficientItemsAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "EnergyEfficientItemsAdjustment").Text) or 0,
CarStorageAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "CarStorageAdjustment").Text) or 0,
PorchPatioDeckAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "PorchPatioDeckAdjustment").Text) or 0,
BlankAdjustment = tonumber(Pro.TextField(comparableType, compIndex, "BlankAdjustment").Text) or 0,
Blank2Adjustment = tonumber(Pro.TextField(comparableType, compIndex, "Blank2Adjustment").Text) or 0,
Blank3Adjustment = tonumber(Pro.TextField(comparableType, compIndex, "Blank3Adjustment").Text) or 0,
}

-- Filter out SalePriceAmount
adjustments.SalePriceAmount = nil

local largestAbsoluteAdj = 0
local largestAdjustmentFields = {}

for fieldName, value in pairs(adjustments) do
local absoluteValue = math.abs(value)
if absoluteValue > largestAbsoluteAdj then
largestAbsoluteAdj = absoluteValue
largestAdjustmentFields = {{fieldName, value}}
elseif absoluteValue == largestAbsoluteAdj then
table.insert(largestAdjustmentFields, {fieldName, value})
end
end

return largestAdjustmentFields
end

-- Function to create a formatted string for a comparable and concatenate the text
function formatComparable(compIndex)
-- Get the street address for the specified comparable
local streetAddress = Pro.TextField(comparableType, compIndex, "StreetAddress").Text

-- Get the second line address for the specified comparable
local secondLineAddress = Pro.TextField(comparableType, compIndex, "SecondLineAddress").Text

-- Get the Sale Price Amount for the specified comparable
local salePriceAmount = Pro.TextField(comparableType, compIndex, "SalePriceAmount").Text

-- Get the net adjustment percentage for the specified comparable
local netAdjustment = Pro.TextField(comparableType, compIndex, "NetAdjustmentPercentage").Text

-- Get the gross adjustment percentage for the specified comparable
local grossAdjustment = Pro.TextField(comparableType, compIndex, "GrossAdjustmentPercentage").Text

-- Get the Gross Living Area Adjustment for the specified comparable
local grossLivingAreaAdjustment = Pro.TextField(comparableType, compIndex, "GrossLivingAreaAdjustment").Text

-- Get the Largest Adjustment(s) for the specified comparable
local largestAdjustmentsList = largestAdjustments(compIndex)

-- Create formatted text
local largestAdjustmentsText = ""
for _, adjustment in ipairs(largestAdjustmentsList) do
local fieldName, value = unpack(adjustment)
largestAdjustmentsText = largestAdjustmentsText .. string.format("%s: %s, ", fieldName, value)
end
largestAdjustmentsText = string.sub(largestAdjustmentsText, 1, -3) -- Remove trailing comma and space

local text = string.format(format, compIndex, streetAddress, secondLineAddress, salePriceAmount, netAdjustment, grossAdjustment, grossLivingAreaAdjustment, largestAdjustmentsText)

-- Concatenate the text
combinedText = combinedText .. text
end

local compCount = Pro.GetCompCount(comparableType)

-- Call the function for Comparables #1 to compCount
for compIndex = 1, compCount do
formatComparable(compIndex)
end

-- Write the combined text to a temporary file
local filePath = os.tmpname()
local file = io.open(filePath, 'w')
file:write(combinedText)
file:close()

-- Add the file contents to a word processing addendum
local useFormWithHeader = true
Pro.InsertWordProcessingDocument(useFormWithHeader, filePath)

-- Delete the temporary file
os.remove(filePath)
 
Find a Real Estate Appraiser - Enter Zip Code

Copyright © 2000-, AppraisersForum.com, All Rights Reserved
AppraisersForum.com is proudly hosted by the folks at
AppraiserSites.com
Back
Top