AppPad Login | Help

Object Type Data Functions

Function (Parameters) Return Description
new <Object Type Name> (strKeyValue,
objField2Value,
...,
objFieldNValue)
objObject An application's defined object types can be instantiated with this format. Created objects fields can be referenced by objObject.<Field Name>. For example, if you define an Object Type named "Car" with fields "make" and "model" then you could instantiate and access the object like so:
var objCar = new Car("Toyota", "Prius");
var strMake = objCar.make; //sets strMake to "Toyota"
appDeleteItem (strObjectType,
strKeyValue,
[strCallback])
Deletes an object of the specified type, where strKeyValue matches the key of a saved item. No delete is performed if the user doesn't have edit access or no item with a matching key exists.
appGetItem (strObjectType,
strKeyValue,
[strCallback])
objObject Gets an object of the specified type matching the key value. The item is only returned if the user has read access.
appGetList (strObjectType,
[strCallback])
objObjectList Gets a list of all objects of the specified type. Items are only returned for which the user has read access.
appGetListMatches (strObjectType,
strKeyMatchExpr,
[strCallback])
objObjectList Gets a list of all objects of the specified type matching the key expression. strKeyMatchExpr will use the % character as a wildcard. Items are only returned for which the user has read access.
appSaveItem (strObjectType,
objObject,
[strCallback])
Saves an object of the specified type. The first field's value is used as the 'key'. A new item will be saved if the key is new, otherwise the existing item will be overwritten. No update is performed if the user doesn't have edit access.
*For functions where [strCallback] is an optional parameter, there is a data operation which must complete. If strCallback is specified, the function will be called asynchronously when the operation is complete. If strCallback isn't passed, the operation must complete before the function returns. If the operation returns a value, it will either be passed to the strCallback function or else when the function returns.

Additional Functions

Function (Parameters) Return Description
appCreateGuid strGuid This function will return a unique string (or GUID), for situations where you want to generate a key value for a new object.
appGetEl (strElementId) ElementReference This is simply a convenience shortcut for the Javascript function document.getElementById().
appLoadYahooPipe (strPipeID,
strCallback,
[objParamList])
This function let's you easily use data from Yahoo! Pipes in your application. (Yahoo! Pipes is an easy way to combine and consume feeds and data from the web). strPipeID should be the id you see in the URL of the Pipe. If the Pipe accepts input fields, you can pass these in an associative array objParamList. strCallback will be called asynchronously passing the Pipe's data when loaded. Tip: Use appStringify if you need help investigating the returned data. (AppPad is not affiliated with Yahoo!)
appRequireLogin () This will redirect users to login before using your application if they aren't already. You may want to include this call in applications that require user data to be stored.
appSortObjects (objObjectList,
strSortField,
intSortDirection)
objObjectList Use this function to sort an object by one of it's fields. strSortField should be the name of the field to be sorted. intSortDirection will sort ascending if 1, and descending if -1.
appStringify (objValue) strJSON Converts an object or value into a JSON string.

Available Objects and Events

Name Description
appOnLoad() If this function is defined in your application, it will be called once the application loads. Declare it with instructions for any loading and display you'd like to trigger to initialize your application.
appParams This object will be initialized with any querystring parameters. For example, adding "&color=blue" to the URL query-string will make appParams["color"] equal to "blue" when running the application. This could be used for linking to specific application states and conditions.
appUser This object holds the id and name of the current user, which you can access via: appUser.id and appUser.name respectively. If the user is not logged in, appUser.id will equal 0 and appUser.name will equal 'Anonymous'.


AppPad | Contact | Terms | About