The GetList method retrieves a list of data from a field in the app in a table format.
int GetList (string tokenIn, string[ ] fields, string where, out string tokenOut, out Datatable table)
Send Params |
Return Params |
||
---|---|---|---|
•fields - This is the field ID that you want to retrieve from the API. The name of the field respects the naming conventions from the SDK and should be fully qualified names. So if the control on the app is named 'First Name' and is placed inside a page called 'Page 1' its qualified name will be 'Page 1|First Name' and the field name should be 'Page_1_First_Name'. The basic rule for converting control names to fields name is replacing each character that is not a name or a letter with '_' (underscore). Additional examples of controls placed in a page called „Page 1”: oControl name: 'Date of birth' -> Field name: „Page_1_Date_of_birth' oControl name: 'Date (MM/dd/yy)' -> Field name: „Page_1_Date__MM_dd_yy_' oControl name: 'Strange!@#$%^&*()_+{}|[]' -> Field name: „Page_1_Strange_________________' oControl name: 'Text 1” -> Field name: 'Page_1_Text_1' Some controls acts as containers so you can place more controls inside. The full name for a text box 'Text 1' placed in a Group or Container 'Group 1' situated in 'Page 1' will be 'Page_1_Container_1_Text_1'.
•tokenIn - This is the security token that is obtained by the previous API call. See the API Security topic for more details.
•where - This parameter specifies a singular where clause to be used. It uses a regular SQL syntax. Sample where clauses: oPage_1_First_Name like 'John%' oPage_2_Amount=100 Note that only a single 'where' clause can be used. Note that use of the where clause may cause performance issues on a large set of data. |
•table - This contains the returned data list. •tokenOut - This is the new security token that should be used for the next Web Service call after this one. See the API Security topic for more details. |
Sample Code
private void ButtonGetList_Click(object sender, EventArgs e)
{
PerfectApps.FirstTestService service;//declare
service = new SDKTest1.PerfectApps.FirstTestService();//instantiate
string tokenIn = "jAgAgEgAggAAAgwA";
string[] fields = new string[0];
string where = string.Empty;
string tokenOut;
DataTable table;
int errorCode;
errorCode = service.GetList(tokenIn, fields, where, out tokenOut, out table);
if (errorCode == 0)
{
MessageBox.Show("I retrieved a list of " + table.Rows.Count + " instances!");
}
else
MessageBox.Show("Error " + errorCode.ToString() + " encountered!");
}
}
Return to: App API Methods, Integration