vCalc provides a set of functions that can be used within an equation or data item algorithm that facilitate using information from tables. The functions are:
Get a dataset row:
Get a dataset column:
Get a dataset cell:
Get a dataset’s latest row:
Get a dataset’s number of rows:
Note: each function requires an ID (uuid) to identify the vCalc table.
Convert a dataset "Date" or "DateTime" type to a formatted string: vCalc datasets include bot a "Date" data type and a "DateTime" data type. When a column is designated as on of these types, the user automatically provided with a calendar (and clock) to choose the date (and time) which is stored in the dataset.
// See Specific Gravity
def gem = args.GEM //User input of gem name from the pulldown list
def tabID = "d39aecee-f011-11e3-b7aa-bc764e2038f2" // Table ID of the specific gravity of gems.
def gems = VDatasetUtils.getColumn(tabID,"gem") // Get the column of gem names
def specGrav = VDatasetUtils.getColumn(tabID,"SG") // Get the column of specific gravities
def numRows = VDatasetUtils.getNumRows(tabID) // Get the number of rows in the spec grav table
def notFound = 1 // Initialize while loop criteria
def i = 0
while ( notFound ){ //Loop through the rows of gems to find the user’s choice.
if (gems[i].equals(gem) )
return specGrav[i] // If gem is found, return the specific gravity for the same row.
i++
If (i >= numRows)
return "gem not found"
}
//See Price drywal 4x8 5/8 inch
def tableID = "a62d5669-4d57-11e4-a9fb-bc764e2038f2" //Set dataset UUID to a local variable (tableID)
def rowVal = VDatasetUtils.getLatestRow(tableID) //Use function to retrieve latest row of data.
def price = rowVal[5] //The latest price of 4x8 5/8in drywall panel
return price