Search:     Advanced search

Item Property Routines

Article ID: 70
Last updated: 22 Sep, 2010
Views: 1663
Posted: 12 Jun, 2008
by Ramsey M.
Updated: 22 Sep, 2010
by Murray D.

These routines are for reading or writing the properties of an item that you would typically view in the "Edit Estimating Item" window.

Here is a list of available item property routines:

function ItemProperty(ItemID, Property)

Description
Returns the value (formula) of a property.
 

Note: This does not return the calculated value (result).  If you are trying to retrieve the result, use ItemPropertyResult.

 
Parameters
ItemID

This is the ID of the item you are accessing the properties of, such as CurrentItem, CurrentTab.

 
Note: Item routines can be used on tabs.
 
Property

This is a string of the name of the property you wish to read, such as "Qty", "Price Each", "Price Total". Some "system" values can be "Name", "Color",  "Item #." The value returned is the formula of the property. Use ItemPropertyResult to retrieve the calculated result.

 
Example
ItemProperty(CurrentItem, "Qty")
 

This example would return the value (formula) of the Qty property.

function ItemPropertyResult(ItemID, Property)

Description
Returns the calculated result of a property.
 
Parameters
ItemID

This is the ID of the item you are accessing the property of, such as CurrentItem, CurrentTab.

 
Property

This is a string of the name of the property you wish to read, such as "Qty", "Price Each", "Price Total". Some "system" values can be "SEGMENT COUNT", "LINEAR TOTAL", "POINT COUNT", "SECTION COUNT". The value to be read is the units of the property.

 
Example
ShowMessage(ItemPropertyResult(CurrentItem, "Qty"))
 

This example would display a message with the result of the property Qty for the currently selected item.

 

function SetItemProperty(ItemID, Property, Value)

Description

Sets the value of a property (formula).  This is equivalent to opening the item in the "Edit Estimating Item" window and typing in a value or formula for a specific property.

Returns 1 if successful 0 if unsuccessful.
 
Parameters
ItemID

This is the ID of the item you are setting the property of, such as CurrentItem, CurrentTab.

 

Note: Item routines can be used on tabs.

 
Property

This is a string of the name of the property you wish to set, such as "Qty", "Price Each", "Price Total". Some "system" values can be "Name", "Color",  "Item #." The value to be set is the formula of the property.

 
Value

This is a string or number value to be set in the formula of the specified property, such as "[Qty] * [Price Each]" or "[Linear Total] / 1.333".

 
Example

SetItemProperty(CurrentItem, "Cubic Yards of Concrete", "([Area] * [Thickness]) / 27")

 

This example would create, or edit if property already exists, the property called Cubic Yards of Concrete and set its value (formula) to ([Area] * [Thickness]) / 27.

 

function ItemPropertyUnits(ItemID, Property)

Description
Returns the units of the property.
 
Parameters
ItemID

This is the ID of the item you are accessing the property of, such as CurrentItem, CurrentTab.

 

Property
This is a string of the name of the property you wish to read, such as "Qty", "Price Each", "Price Total". Some "system" values can be "SEGMENT COUNT", "LINEAR TOTAL", "POINT COUNT", "SECTION COUNT". The value to be read is the units of the property.

 
Example
units = ItemPropertyUnits(CurrentItem, "Qty")
ShowMessage("The units for the Qty property are: " & units)
 

This example would display a message of what the units for the Qty property are currently set to.

 

function SetItemPropertyUnits(ItemID, Property, Units)

Description
Sets the units of the property.
Returns 1 if successful 0 if unsuccessful.
 
Parameters
ItemID

This is the ID of the item you are setting the property of, such as CurrentItem, CurrentTab.

 
Property

This is a string of the name of the property you wish to set, such as "Qty", "Price Each", "Price Total". Some "system" values can be "SEGMENT COUNT", "LINEAR TOTAL", "POINT COUNT", "SECTION COUNT". The value to be set is the units of the property.

 
Units

This is a integer value of the number of decimal places to be displayed on the result of the specified property.

 
Example
SetItemPropertyUnits(CurrentItem, "QTY", "SQ FT")
 

This example would set the units for the Qty property to SQ FT.

 

function GetPropertyFromColumn(ItemID, Column)

 
Description

Returns the name of the property with that column (or blank).  This would typically be used in conjunction with a GetProperty method, since this routine does not return the value or result, only the name of the matching property.

 
Parameters
ItemID

This is the ID of the item you are accessing the property of, such as CurrentItem, CurrentTab.

 
Column

This is a string of the name of the column you wish to access from the specified property, such as "Qty", "Price Each", "Price Total".

 
Example
ShowMessage(ItemPropertyResult(CurrentItem, GetPropertyFromColumn(CurrentItem, "Price Total")))
 

The example will display a message of the result of the property that is designated for the Price Total column.

 

function SetItemPropertyColumn(ItemID, Property, Column)

Description

Sets the column of the property.  When you set the column of a property, it determines which column that property will show in, in the estimating window.

Returns 1 if successful 0 if unsuccessful.
 
Parameters
ItemID

This is the ID of the item you are setting the property of, such as CurrentItem, CurrentTab.

 
Property

This is a string of the name of the property you wish to set, such as "Qty", "Price Each", "Price Total". Some "system" values can be "SEGMENT COUNT", "LINEAR TOTAL", "POINT COUNT", "SECTION COUNT". The value to be set is the column name of the property.

 
Column

This is a string of the name of the column you wish to set the specified property to report to in the estimate, such as "Qty", "Price Each", "Price Total".

 
Example:

If you created a property called "Qty of Yards" with a formula for calculating yards of concrete, you could set the column to "Qty", so that the calculated result will show in the "Qty" column on the estimate.

 
SetItemPropertyColumn(CurrentItem, "Qty of Yards", "Qty")
 

function DeleteItemProperty(ItemID, Property)

Description
Deletes property from item.
Returns 1 if successful 0 if unsuccessful.
 
Parameters
ItemID

This is the ID of the item you are deleting the property of, such as CurrentItem, CurrentTab.

 
Property

This is a string of the name of the property you wish to delete, such as "Qty", "Price Each", "Price Total". "System" values cannot be deleted.

 
Example
DeleteItemProperty(CurrentItem, "Qty")
 

This example would delete the Qty property from the currently selected item.

 

function GetItemPropertyDigits(ItemID, Property)

Description

Returns number of digits to the right of the decimal for a property.

 
Parameters
ItemID

This is the ID of the item you are accessing the property of, such as CurrentItem, CurrentTab.

 
Property

This is a string of the name of the property you wish to read, such as "Qty", "Price Each", "Price Total". Some "system" values can be "SEGMENT COUNT", "LINEAR TOTAL", "POINT COUNT", "SECTION COUNT". The value to be read is the digits the of the property.

 
Example

NumOfDigits = GetItemPropertyDigits(CurrentItem, "Price Each")

ShowMessage("Price Each has " & NumOfDigits & " digits")
 

This example would return how many digits are assigned to the Price Each property of the currently selected item.

 

procedure SetItemPropertyDigits(ItemID, Property, Value)

Description
Sets the digits of a property
 
Parameters
ItemID

This is the ID of the item you are setting the property of, such as CurrentItem, CurrentTab.

 
Property

This is a string of the name of the property you wish to set, such as "Qty", "Price Each", "Price Total". Some "system" values can be "SEGMENT COUNT", "LINEAR TOTAL", "POINT COUNT", "SECTION COUNT". The value to be set is the digits the of the property.

 
Value

Integer value of how may digits to display to the right of the decimal.

 
Example
SetItemPropertyDigits(CurrentItem,"Price Each",2)
 

This example would set the decimal places of the Price Each property for the currently selected item to 2 decimal places.

 

function ItemPropertyLocked(ItemID, Property)

Description
Returns true if locked and false if the property is unlocked
 
Parameters
ItemID

This is the ID of the item you are accessing the property of, such as CurrentItem, CurrentTab.

 
Property

This is a string of the name of the property you wish to check if locked, such as "Qty", "Price Each", "Price Total". "System" values cannot be unlocked.

 
Example
if ItemPropertyLocked(CurrentItem, "Qty")then
  ShowMessage("Property is locked!")
else
  ShowMessage("Property is not locked, or does not exist!")
end if
 

This example would show the message "Property is locked" if property was locked, and if the property is unlocked it would show the message "Property is not locked".

 

procedure LockItemProperty(ItemID, Property, Locked)

Description
Locks a property
 
Parameters
ItemID

This is the ID of the item you are accessing the property of, such as CurrentItem, CurrentTab.

 
Property

This is a string of the name of the property you wish to lock or unlock, such as "Qty", "Price Each", "Price Total". "System" values cannot be unlocked.

 
Locked
Possible Values: True(1), False(0)
 
Example
LockItemProperty(CurrentItem,"Qty", True)
 

This example would lock the Qty property of the currently selected item.

 

function HasProperty(ItemID, Property)

Description

Returns true if property exists or false if property does not exist.

 
Parameters
ItemID

This is the ID of the item you are accessing the property of, such as CurrentItem, CurrentTab.

 
Property

This is a string of the name of the property you wish to check if exists, such as "Qty", "Price Each", "Price Total". Some "system" values can be "SEGMENT COUNT", "LINEAR TOTAL", "POINT COUNT", "SECTION COUNT". The value to be check is the name of the property.

 
Example
if HasProperty(CurrentItem, "Qty") then
  ShowMessage("Property Qty does exist!")
else
  ShowMessage("Property Qty does not exist!")
end if
 

This example would show the message "Property Qty does exists!") if the property existed or "Property Qty does not exist!" if the property does not exist.

This article was:  
Prev  Not what you're looking for? Suggest a topic  Next
Graphics Routines     Item Routines