Ebase Xi Client API – Quick Reference Card

 

Getting a field

 

var field = $eb.getField("FIELD1");

var value = field.value;

var displayValue = field.displayValue;

 

 

Getting multiple fields

 

var fields = $eb.getFields(["FIELD1", "FIELD2"]);

 

var value1 = fields.FIELD1.value;

var displayValue1 = fields.FIELD1.displayValue;

 

var value2 = fields.FIELD2.value;

var displayValue2 = fields.FIELD2.displayValue;

 

 

Getting a field’s value

 

var value = $eb.getFieldValue("FIELD1");

 

 

Setting a field

 

var field = $eb.getField("FIELD1");

field.value = "New Value";

$eb.setField(field, true); // auto refresh

 

 

Setting multiple fields

 

var field1 = $eb.getField("FIELD1");

field1.value = "New Value";

 

var field2 = new $eb.Field("FIELD2", "A Value");

 

$eb.setFields([field1, field2], true); // auto refresh

 

 

Setting a field’s value

 

$eb.setFieldValue("FIELD1", "New Value");

$eb.setFieldValue("FIELD1", "New Value", true); // auto refresh

 

 

Getting a table

 

var table = $eb.getTable("TABLE1");

 

 

Getting selected rows of a table

 

var table = $eb.getTableFilteredByRows("TABLE1", 4, 6); // start on the row id 4 and return the next 6 rows

 

 

Getting multiple tables

 

var tables = $eb.getTables(["TABLE1", "TABLE2"]);

var table1 = tables.TABLE1;

var table2 = tables.TABLE2;

 

 

Getting a table column value

 

var column1value = table.COLUMN1().value;

 

 

Getting a table column value for a specific row

 

table.setCurrentRow(2);

var column1value = table.COLUMN1().value;

 

var column2value = table.getColumnValueOnRow(“COLUMN2”, 2);

 

 

Getting a table column display value for a specific row

 

table.setCurrentRow(2);

var column1value = table.COLUMN1().displayValue;

 

var column2value = table.getColumnDisplayValueOnRow(“COLUMN2”, 2);

 

 

Getting number of rows in table

 

table.getRowCount();

 

 

Find row with column value

 

var row = table.findRow("COLUMN1", "123123");

 

var value;

if (row != -1)

{

    value = table.getColumnValueOnRow(row)

}

 

 

Looping through all table rows

 

var value = 0;

 

var rows = table.getRows();

rows.first(); // go to start row

 

while(rows.next())

{

value += table.COLUMN1().value;

}

 

 

Reverse through all table rows

 

var value = 0;

 

var rows = table.getRows();

rows.last(); // go to last row

 

while(rows.previous())

{

value += table.COLUMN1().value;

}

 

 

Execute a function

 

$eb.executeFunction("doStuff");

$eb.executeFunction("doStuff", 2); // pass in parameter

$eb.executeFunction("doStuff" [2, 3]); // pass in array of parameters

$eb.executeFunction("doStuff", [2, 3], true); // auto refresh

$eb.executeFunction("doStuff", [2, 3], true, true); // full submit

 

 

Execute a function asynchronously

 

var success = function(data){alert ("Success: " + data); };

var failure = function(reason){alert ("Failed: " + reason); };

 

$eb.executeFunctionAsynchronously(success,failure,"doStuff");

$eb.executeFunctionAsynchronously(success,failure,"doStuff",2); $eb.executeFunctionAsynchronously(success,failure,"doStuff",[2,3]); $eb.executeFunctionAsynchronously(success,failure,"doStuff",2,true); $eb.executeFunctionAsynchronously(success,failure,"doStuff",2,true,true);