Table of Contents

Inline Scripts

As of version 1.4, Appraise-It Pro supports executing single-line Lua expressions within text fields.


Overview

Any single-line Lua expression you might save in a script file can also be entered directly into a text field; Appraise-It Pro will execute the expression and insert its result in the text field when you leave the field.

(However, CoreModules.Preset_SoftSandbox is specified to the scripting engine to prevent more dangerous API calls, such as writing or deleting files.)

Good to Know

  • The Lua expression won't be saved in the text field, only the calculated result.

  • You can save Lua expressions as common or global responses for reuse.

  • The Lua expression must be the only value entered in the text field. In other words, you can't execute a Lua expression in the middle of other text.

How It Works

Inline Lua expressions are limited to one line of code and must begin with a "=" character. (Multi-line expressions must still be saved and executed as described in the Scripting API Introduction.)

Pro.SelectedTextField is automatically inserted at the beginning of the expression. For example,

= 65000 + 52500

becomes

Pro.SelectedTextField = 65000 + 52500

when passed to the Lua interpeter.

Sample Single-Line Lua Expressions

Inline Lua expressions can be very useful for performing calculations or inserting data.

Mathematical Operations

= 65000 + 52500

will result in "117500".

= Pro.TextField("SalePriceAmount").Number - Pro.TextField("TransferPriceAmount").Number

will subtract the subject's Price of Prior Sale/Transfer from its Sale Price.

= Pro.TextField("SalesComparables", 1, "SalePriceAmount").Number - Pro.TextField("SalesComparables", 1, "TransferPriceAmount").Number

will subtract comp 1's Price of Prior Sale/Transfer from its Sale Price.

= Pro.TextField("FoundationBasementArea").Number * 15

will multiply the subject's Basement Area by a factor of 15.

= (Pro.TextField("IndicatedValueSalesComparisonApproachAmount").Number + Pro.TextField("IndicatedValueCostApproachAmount").Number + Pro.TextField("IndicatedValueIncomeApproachAmount").Number) / 3

will average the subject's Indicated Values by Sales Comparison Approach, Cost Approach, and Income Approach.

Data Insertion

= os.date("%m/%d/%Y")

will insert today's date in MM/DD/YYYY format.

= "The subject property's appraised value is $" .. Pro.TextField("AppraisedValueAmount").Text .. " as of " .. Pro.TextField("AppraisedValueDate").Text .. "."

will insert a sentence listing the subject's appraised value and valuation date.