Cell Data
getCellDataForAttr(int cell_id, string attrName)
This method returns a string containing the value of attrName for the given cell_id. This is useful when the developer wants to read only certain attributes of a cell and not all of the cell's data. Please note that all values are returned as a string.
Example:
var mouseOverCell = function() {
try {
var hc_js = com.visualaction.worldpop.services;
// get info from event payload
var cellId = parseInt(fieldApplet.getMouseOverCellId());
if (cellId != null && cellId != undefined && !isNaN(cellId)) {
}
} catch(err) {
alert(err.message);
}
};
getCellData(int cell_id)
This method returns all data for a given cell_id in the form of name:value pairs where name is the attribute name and value is the value of that field.
Example:
{
"columns":["l1_str","l2_str","image","l3_str","dateStr","desc","dateStr2","index","l1_enum","l2_enum","l3_enum","b1","v1","v2",
"v3","v4","pct","time","rating"],
"Data":["L1_I","L2_B","test.gif","L3_A","03/31/2004","Note that this is in use.","20040331","256.0","8.0","1.0","0.0","1.0",
"0.95829","-0.34893","0.4857","630.0","0.7","0.49003","1.0"]
}
registerAggregateValue(string agg_value_name, function agg_function)
This method registers a javascript function that implements a custom aggregation value. The supplied function will take a set of data values associated with a group and compute (and return) a new single value that represents the desired aggregation.
Example:
// Create a function to compute an aggregate value
function myNewAggregateFunction(groupLevel, nameOfColumn, dataTypeOfColumn, listOfValues) {
// groupLevel is 1, 2, 3, ... depending on nesting
// nameOfColumn is the column name, such as "Quota_Percent"
// dataTypeOfColumn is the column type, such as NUMBER, TEXT, or DATE
// listOfValues is an array of column values, such as [93, 99, 103, 109] or ["John Doe", "Jane Doe"]
// Loop through the listOfValues array to compute a custom aggregate value.
...
return theAggregateValue;
}
// Register the new aggregate function and provide a name for the new value
// Make sure to call registerAggregateValue() before calling onload()
flaremapServices.registerAggregateValue("nameOfNewAttribute", myNewAggregateFunction);
updateRows(array rows)
This method updates the data with the provided rows. The first item in the rows array is an array of strings containing all the column names, and each subsequent array contains data values that correspond to the columns defined in the first row. All of the columns defined in CSV_DataTypes.cells must be present in the rows array. The provided data rows will replace the corresponding existing data row; if one is not present then a new data row is created. It’s thus only necessary to include rows for which data has changed.
Example:
// Update two data rows
updateRows([
['Sales_Rep', 'Sales_Manager', 'Sales_Region', 'Total_Sales_Q4', 'Quota_Q4', 'Quota_Percent'],
['Brett Black', 'Albert Bachman III', 'Mountain West',400000,500000, 80],
['Vincent Iorio', 'Albert Bachman III', 'Mountain West', 300000,400000, 75]
]);
removeRows(array rows)
This method removes the provided rows from the data. The first item in the rows array is an array of strings containing all the column names, and each subsequent array contains data values that correspond to the columns defined in the first row. All of the columns defined in CSV_DataTypes.cells must be present in the rows array. Any existing rows that correspond to the provided data rows will be removed.
Example:
// Remove two data rows
removeRows([
['Sales_Rep', 'Sales_Manager', 'Sales_Region', 'Total_Sales_Q4', 'Quota_Q4', 'Quota_Percent'],
['Brett Black', 'Albert Bachman III', 'Mountain West',400000,500000, 80],
['Vincent Iorio', 'Albert Bachman III', 'Mountain West', 300000,400000, 75]
]);