rex_backendless_savedata
Introduction
Save slots on backendless.
Save slots on backendless.
Usage
Sample capx
Sample capx
Concept
Each user has a dedicate slots set. Each slot is stores in a row, some keys are slot header.
Each user has a dedicate slots set. Each slot is stores in a row, some keys are slot header.
Set Owner
Each user has a dedicate slots set. So first step is to set the owner user by "Action:Set owner".
Set "User ID" to "Expression:UserID" of rex_backendless_authentication.
Each user has a dedicate slots set. So first step is to set the owner user by "Action:Set owner".
Set "User ID" to "Expression:UserID" of rex_backendless_authentication.
Set keys of header
Header is some keys (fields) in a slot. Keys of header could be assigned in property "Header keys", or add keys by "Action:Add header key".
Header is some keys (fields) in a slot. Keys of header could be assigned in property "Header keys", or add keys by "Action:Add header key".
Load
Follow these steps to load a slot from cloud after set owner.
Follow these steps to load a slot from cloud after set owner.
Get headers
1. Call "Action:Get all headers" to get all headers of this owner user. "Condition:On get headers" will be triggered if get all headers.
2. There are three ways to retrieve header for showing them at UI -
- a. "Condition:For each header", then get each slot name by "Expression:CurSlotName", and get value by "Expression:CurHeaderValue( key )". Or retrieve each key of a header by "Condition:For each key" under "Load - header" category, then read key and value by "Expression:CurKey", and "Expression:CurValue".
- b. get value by "Expression:HeaderValue( slotName, key )".
- c. get headers in items list by "Expression:HeadersAsItemList", then put this list into rex_taffydb object.
1. Call "Action:Get all headers" to get all headers of this owner user. "Condition:On get headers" will be triggered if get all headers.
2. There are three ways to retrieve header for showing them at UI -
- a. "Condition:For each header", then get each slot name by "Expression:CurSlotName", and get value by "Expression:CurHeaderValue( key )". Or retrieve each key of a header by "Condition:For each key" under "Load - header" category, then read key and value by "Expression:CurKey", and "Expression:CurValue".
- b. get value by "Expression:HeaderValue( slotName, key )".
- c. get headers in items list by "Expression:HeadersAsItemList", then put this list into rex_taffydb object.
Get body
3. Call "Action:Get body" with a slot name parameter to get selected slot body. "Condition:On get body" will be triggered if get body. "Condition:On get body error" will be triggered if got nothing.
4. Get body value by "Expression:BodyValue( key )". Or retrieve each key of a body by "Condition:For each key" under "Load - body" category, then read key and value by "Expression:CurKey", and "Expression:CurValue".
3. Call "Action:Get body" with a slot name parameter to get selected slot body. "Condition:On get body" will be triggered if get body. "Condition:On get body error" will be triggered if got nothing.
4. Get body value by "Expression:BodyValue( key )". Or retrieve each key of a body by "Condition:For each key" under "Load - body" category, then read key and value by "Expression:CurKey", and "Expression:CurValue".
If there is only a slot, the slot body could be load directly by step 3, 4.
After got headers, there are some conditions could be used to test if a slot is existed.
After got headers, there are some conditions could be used to test if a slot is existed.
- "Condition:Empty" is used to test if there is no slot.
- "Condition:Is occupied" is used to test if a specific slot had been used.
Get value by key and default value
These expressions will read value by key,
These expressions will read value by key,
- Expression:CurHeaderValue( key )
- Expression:HeaderValue( slotName, key )
- Expression:BodyValue( key )
- Expression:CurHeaderValue( key , default_value )
- Expression:HeaderValue( slotName, key, default_value )
- Expression:BodyValue( key, default_value )
- Expression:CurHeaderValue
- Expression:HeaderValue( slotName ) , a header in JSON
- Expression:HeaderValue( slotName ) , all header in JSON
- Expression:BodyValue
Clean
Call "Action:Clean slot" to clean a slot, header and body. Or call "Action:Clean all slots" to clean all slots.
"Condition:On clean" will be triggered if clean completed, otherwise "Condition:On clean error" will be triggered.
These actions will clean current loaded headers.
Call "Action:Clean slot" to clean a slot, header and body. Or call "Action:Clean all slots" to clean all slots.
"Condition:On clean" will be triggered if clean completed, otherwise "Condition:On clean error" will be triggered.
These actions will clean current loaded headers.
Save
Follow these steps to save a slot on server.
Follow these steps to save a slot on server.
- Call "Action:Set value" or "Action:Set boolean value" to assign value with key.
- Call "Action:Save" to save this slot on cloud by slot name.
- "Condition:On save" will be triggered if saving completed, otherwise "Condition:On save error" will be triggered. Get last saved slot name by "Expression:LastSlotName", or error message by "Expression:ErrorMessage".
Last saved time
Last saved time would be stored at key "updated" ( Expression:KeyLastSaveTime ).
User could get the last saved time of a specific header by Expression:CurHeaderValue( Expression:KeyLastSaveTime ), or get the last saved time of body by Expression:BodyValue( Expression:KeyLastSaveTime ).
These would return an unixtimestamp, put this value into rex_date to get Year/Month/Date, Hour/Minute/Second.
Last saved time would be stored at key "updated" ( Expression:KeyLastSaveTime ).
User could get the last saved time of a specific header by Expression:CurHeaderValue( Expression:KeyLastSaveTime ), or get the last saved time of body by Expression:BodyValue( Expression:KeyLastSaveTime ).
These would return an unixtimestamp, put this value into rex_date to get Year/Month/Date, Hour/Minute/Second.
Cache
Set property "Cache" to "Yes" to cache the objectId of slot. It could save 1 backendless access when saving slot.
Set property "Cache" to "Yes" to cache the objectId of slot. It could save 1 backendless access when saving slot.
Debug message
Current loaded slot values will be shown at debug panel.
Current loaded slot values will be shown at debug panel.
Compare with rex_parse_savedata plugin
This plugin only uses 1 table to store header and body in a row. rex_parse_savedata plugin uses 2 tables.
One last important thing, parse service will be closed.
This plugin only uses 1 table to store header and body in a row. rex_parse_savedata plugin uses 2 tables.
One last important thing, parse service will be closed.