Skip to content

Latest commit

 

History

History
97 lines (62 loc) · 2.34 KB

Mobile App Action.md

File metadata and controls

97 lines (62 loc) · 2.34 KB

Mobile App Action

Utility methods to get dataClass or entity to apply action when inside On Mobile App Action database method.

Usage

in On Mobile App Action wrap the first input parameters

$action:=Mobile App Action($1) // $1 Informations provided by mobile application

Then you can switch as usual on action name and use of the function

Case of
        //________________________________________
    : ($action.name="purgeAll") // Purge all, action scope is table/dataclass

        $dataClass:=$action.getDataClass()
        // Insert here the code to purge all entities of this dataClass.

        //________________________________________
    : ($action.name="add") // Add a new entitys

        $book:=$action.newEntity()
        $status:=$book.save()
        //________________________________________
    : ($action.name="rate") // Rate a book, action scope is entity

        $book:=$action.getEntity()
        // Insert here the code for the action "Rate and Review" the book

End case

all scope

getDataClass()

This return the dataClass associated to the action.

$dataClass:=$action.getDataClass()

newEntity()

Create a new instance of entity associated to the action data class; same as getDataClass().new()

$aNewEntity:=$action.newEntity()

current record scope

getEntity()

Get the entity associated to the action.

$entityToApplyAction:=$action.getEntity()

This return Null if the action scope is not "current record"

dropEntity()

Drop the entity associated to the action; same as getEntity().drop()

$status:=$action.dropEntity()

work with relations

When navigating in mobile application you need some information about context.

For instance you are on one parent record/entity of type "company" and then you display the company "employee" list. You need to know the parent "company" to add or remove an "employee" from this list.

getParent()

You can get the parent entity associated to the action.

$parentEntity:=$action.getParent()

unlink()

You can unlink on entity from its parent.

$operationResult:=$action.unlink()                    
$status:=$operationResult.save() // to save record