v1.0
Jivox API Documentation

dynamicDataCallback

This sophisticated API uses a method called chaining that enables a developer to call multiple methods on the same object, and allows for very flexible dynamic data lookup. It is suitable for complex use cases that require returning one of multiple matching rows, ordering etc.

To use this API,

1- First build the request query chains

Format:

Javascript
Copy
Method(Parameters)RequiredDescriptionExample Usage
assetDBReq(assetSource)YesName of the asset source to queryassetDBReq("NumbersTest")
keys(list of keys)YesSpecify one or more key values to query forkeys("3,5,7")
max(number of rows returned)YesRestrict number of returned rows, with multiple matching rows on lookup. Rows returned will be equal to or less than max rows specifiedmax(5)
order(random or asc or desc)NoSpecify ordering for multiple matchesorder(random)
orderBy(name of column for sorting response)NoSpecify the column to use for sorting (ascending or descending)orderBy(Display)
build()YesComplete query

Examples: To query asset source NumbersTest for key '3', and return the first 5 matching values sorted by the column named 'Display':

Javascript
Copy

To query the asset source NumbersTest for keys '3' and '5', and return the first matching value for each lookup:

Javascript
Copy

2- Next attach query to one or more callback functions.

Format:

Method(Parameters)RequiredDescriptionExample Usage
dynamicDataCallback(CallbackFunction)YesName of callback functiondynamicDataCallback('callback')

get()

OR

get(list of query chains)

YesExplicitly specify queries to execute, or leave blank to execute all defined queries

get()

get(NumbersTestSortedLookup, NumbersTestTwoKeyLookup)

Examples:

Return Data for a Single Row

This example implements the same functionality as:

Javascript
Copy

The sample code below fetches a single row with key '5' from the asset source "NumbersTest" and pretty prints it.