FormRun.dataSourceCount Method
Retrieves the number of data sources that are associated with a form.
Syntax
public int dataSourceCount()
Run On
Client
Return Value
Type: int
An integer value that specifies the number of data sources.
Examples
The following example shows a call to the dataSourceCount method to return the number of data sources that are associated with the form. Two data sources are added to the form by using the Form.addDataSource method.
static void createForm2(Args _args)
{
Args args;
Form form;
FormRun formRun;
FormBuildDesign formBuildDesign;
FormBuildDataSource formBuildDataSource;
FormBuildDataSource formBuildDataSource2;
FormBuildGridControl formBuildGridControl;
DictTable dictTable;
DictTable dictTable2;
int idx;
int dataSourceNum;
// Create the form header.
form = new Form();
// Add data sources to the form.
dictTable = new DictTable(77);
formBuildDataSource = form.addDataSource(dictTable.name());
formBuildDataSource.table(dictTable.id());
dictTable2 = new DictTable(78);
formBuildDataSource2 = form.addDataSource(dictTable2.name());
formBuildDataSource2.table(dictTable.id());
// Create the form design.
formBuildDesign = form.addDesign("Design");
// Add controls.
formBuildGridControl =
formBuildDesign.addControl(FormControlType::Grid, "Table Grid");
formBuildGridControl.dataSource(dictTable.name());
idx = formBuildGridControl.id();
// Add data fields to controls.
formBuildGridControl.addDataField
(formBuildDataSource.id(),dictTable.fieldName2Id("AccountNum"));
args = new Args();
args.object(form);
// Create the run-time form.
formRun = new FormRun(Args);
formRun.run();
formRun.detach();
dataSourceNum = formRun.dataSourceCount();
}