The BINDAPI() function is used to fetch data from a connector and bind it to the selected control. The data is fetched from the Connector configured may it be a DB Connector or any other Custom API.
BINDAPI([connectorname.result.rows.columnname1, connectorname.result.rows.columnname2,…], Filter Condition, Sort column,Order)
Let us take a simple example here to bind a Tablegrid control to a Connector. The connector fetches all author data from the author’s Collection. However, for this example we want to add only those rows where it contains the letter “A”. Also we want to sort it based on Last_name and show them in Descending order.
BINDAPI( [AuthorMongoDB.result.rows.author_id,AuthorMongoDB.result.rows.name,AuthorMongoDB.result.rows.last_name], AuthorMongoDB.result.rows.name $cn “A”, AuthorMongoDB.result.rows.last_name, “DESC”)
Where the data is fetched as per the Connector configuration to get all rows from the MongoDB connectors.
In this case, the data for the three columns would be fetched first, out of these columns those rows which contain the “A” alphabet would be filtered out and then these rows fetched would then be arranged in a descending order based on the last name. Make sure that you bind all the columns that you need to use for filtering or sorting.
Important Note: Filter and Sorting happen at the client-side once we get the result from API.
Now let us take a preview to understand how the data is fetched and reflected to the table grid control.