rex_parse_itemtable
Introduction
Items table indexed by (itemID, key), supports writing an item or reading items back.
Items table indexed by (itemID, key), supports writing an item or reading items back.
Class name
"Class name" in properties table is the "table name" shown at dash board.
"Class name" in properties table is the "table name" shown at dash board.
Write an item
Sample capx
Sample capx
Prepare
Before write an item, it needs prepare this item first by these actions -
Before write an item, it needs prepare this item first by these actions -
- Action:Set value,
- Action:Set boolean value
- Action:Increase value
- Action:Remove key
- Action:Set itemID ( objectID )
Write
Then call "Action:Save" to save prepared item. Server will append a new item if itemID had not be assigned by "Action:Set itemID".
"Condition:On save complete" would be triggered while saving this item successful, otherwise "Condition:On save error" will be triggered. Get object ID of saved item by "expression:LastSavedItemID".
Then call "Action:Save" to save prepared item. Server will append a new item if itemID had not be assigned by "Action:Set itemID".
"Condition:On save complete" would be triggered while saving this item successful, otherwise "Condition:On save error" will be triggered. Get object ID of saved item by "expression:LastSavedItemID".
Primary key
Sample capx
Set parameter "Key type" to "primary key" in "Action:Set value", or "Action:Set boolean value" could assign this key to be a primary key. i.e. unique key.
Then calls "Action:Save" to save this item which has primary key(s). Plugin first fetches the objectID which has these unique key(s), then overwrites it with prepared item.
"Condition:On save complete" or "Condition:On save error" will be triggered after saved, too.
Primary keys also could be defined at "Primary keys" in properties table, or by "Action:Set primary keys". Multiple keys are joined by ",". For example, joining primary keys "key0", and "key1" to "key0,key1".
Sample capx
Set parameter "Key type" to "primary key" in "Action:Set value", or "Action:Set boolean value" could assign this key to be a primary key. i.e. unique key.
Then calls "Action:Save" to save this item which has primary key(s). Plugin first fetches the objectID which has these unique key(s), then overwrites it with prepared item.
"Condition:On save complete" or "Condition:On save error" will be triggered after saved, too.
Primary keys also could be defined at "Primary keys" in properties table, or by "Action:Set primary keys". Multiple keys are joined by ",". For example, joining primary keys "key0", and "key1" to "key0,key1".
Save all
Sample capx
This plugin also support save mutiple items in 1 request.
Prepared items also could have primary keys (sample capx). Plugin will first fetch itemID (objectID) by primary keys, these require extra requests, then do saving all.
Sample capx
This plugin also support save mutiple items in 1 request.
- Call :Action:Add to queue" to append prepared items into save-all queue.
- Finally call "Action:Save all" to save all items in save-all queue.
Prepared items also could have primary keys (sample capx). Plugin will first fetch itemID (objectID) by primary keys, these require extra requests, then do saving all.
Read items
There are some ways to read items back,
There are some ways to read items back,
- using filter to get matched items, or
- using object ID of item ( itemID ) to get specific item.
Read by filter
Sample capx
There are 5 kinds of filter for messages:
1. create a new filter by "Action:1. New"
2. add filter conditions by
4. set fetched fields by
Sample capx
There are 5 kinds of filter for messages:
- itemID (objectID) include
- value include
- value compare: "equal to", "not equal to", "greater than", "less than", "greater than or equal to", "less than or equal to"
- timestamp constraint
- string value start with
- key exist
1. create a new filter by "Action:1. New"
2. add filter conditions by
- Action:2. all values
- Action:2. itemID include
- Action:2. value include
- Action:2. value compare
- Action:2. timestamp constraint
- Action:2. string value start with
- Action:2. key exist
4. set fetched fields by
- Action:4. add all keys
- Action:4. add a ke
Read items
After build a new filter by these steps, call one of request actions to start fetching -
After build a new filter by these steps, call one of request actions to start fetching -
Pages
- Action:Turn to page
- Action:Update current page
- Action:Turn to next page
- Action:Turn to previous page
Start from any index
Or call "Action:Load in a range" to fetch ordered items started from any index.
Do not mix this action with pages type requests described at previous section.
Or call "Action:Load in a range" to fetch ordered items started from any index.
Do not mix this action with pages type requests described at previous section.
All items
Sample capx
Get all queried items by "Action:Load all queried items".
This action will fetch queried items page by page (each page is 1000 lines), until lines count of received page is less than 1000. i.e. the last page.
Sample capx
Get all queried items by "Action:Load all queried items".
This action will fetch queried items page by page (each page is 1000 lines), until lines count of received page is less than 1000. i.e. the last page.
Random items
Sample capx
Get queried items by "Action:Get random queried items".
This action first fetches all queried itemID (objectID) back, then pick some items randomly. Finally fetching items by these picked itemID. It needs at last 2 requests to get random items.
Or user could get all queried items by "Action:Load all queried items", then get items randomly while received.
Sample capx
Get queried items by "Action:Get random queried items".
This action first fetches all queried itemID (objectID) back, then pick some items randomly. Finally fetching items by these picked itemID. It needs at last 2 requests to get random items.
Or user could get all queried items by "Action:Load all queried items", then get items randomly while received.
Retrieve items
"Condition:On received" will be triggered when received requested messages. Then uses these methods to retrieve values.
"Condition:On received" will be triggered when received requested messages. Then uses these methods to retrieve values.
Retrieve items in for each loop
"Condition:For each item" or "Condition:For each item in a range" could retrieve items in a for each loop, gets item's value by these expressions.
"Condition:For each item" or "Condition:For each item in a range" could retrieve items in a for each loop, gets item's value by these expressions.
- Expression:CurItemIndex, which is 0-based
- Expression:CurItemID
- Expression:CurSentAt
- Expression:CurItemContent
- "Expression:CurItemContent" without any parameter, will return key-value pairs of current item in JSON string.
- "Expression:CurItemContent( key )" , will return the value of a specific key, or return 0 if the key does not exist.
- "Expression:CurItemContent( key, default_value )" , will return the value of a specific key, or return default value if the key does not exist.
Retrieve items by item index
Get received item by item index by "Expression:Index2ItemContent". Like "Expression:CurItemContent", there are 3 kinds of
return value.
Get received item by item index by "Expression:Index2ItemContent". Like "Expression:CurItemContent", there are 3 kinds of
return value.
- "Expression:Index2ItemContent( index )", will return key-value pairs of indexed item in JSON string.
- "Expression:Index2ItemContent( index, key )" , will return the value of a specific key, or return 0 if the key does not exist.
- "Expression:Index2ItemContent( index, key, default_value )" , will return the value of a specific key, or return default value if the key does not exist.
Retrieve all items in JSON string
Get JSON string of all received items by "Expression:ItemsToJSON". User could put this JSON string into Yann's JSON plugin.
Get JSON string of all received items by "Expression:ItemsToJSON". User could put this JSON string into Yann's JSON plugin.
Read by object ID of item
Call "Action:Load by itemID" to read item by object ID."Condition:On load by itemID" will be triggered when loading success, otherwise "Condition:On load by itemID error" will be triggered. Get item fields by these expressions-
Call "Action:Load by itemID" to read item by object ID."Condition:On load by itemID" will be triggered when loading success, otherwise "Condition:On load by itemID error" will be triggered. Get item fields by these expressions-
- Expression:LastFetchedItemID
- Expression:LastFetchedSentAt
- Expression:LastFetchedItemContent
- "Expression:LastFetchedItemContent" without any parameter,will return key-value pairs of fetched item in JSON string.
- "Expression:LastFetchedItemContent( key ) , will return the value of a specific key, or return 0 if the key does not exist.
- "Expression:LastFetchedItemContent( key, default_value ) , will return the value of a specific key, or return default value if the key does not exist.
Remove items
There are two ways to remove messages -
There are two ways to remove messages -
- by itemID (objectID),
- by filter.
Remove by object ID
Call "Action:Remove by itemID" to remove an item by object ID.
"Condition:On remove by itemID complete" will be triggered when removing success. Get removed itemID by "Expression:LastRemovedItemID".
Otherwise "Condition:On remove by itemID error" will be triggered.
Call "Action:Remove by itemID" to remove an item by object ID.
"Condition:On remove by itemID complete" will be triggered when removing success. Get removed itemID by "Expression:LastRemovedItemID".
Otherwise "Condition:On remove by itemID error" will be triggered.
Remove by filter
Sample capx
It also supports removing items picked by filter.
First creating a new filter described at previous section, then call "Action:Remove queried items" to remove them.
"Condition:On remove queried items complete" will be triggered when all items removed success, otherwise "Condition:On remove queried items error" will be triggered.
Sample capx
It also supports removing items picked by filter.
First creating a new filter described at previous section, then call "Action:Remove queried items" to remove them.
"Condition:On remove queried items complete" will be triggered when all items removed success, otherwise "Condition:On remove queried items error" will be triggered.
Items count
Sample capx
Get filtered items count by "Action:Get items count" after build a new filter. The result is put at "Expression:LastItemsCount" under "Condition:On get items count complete", otherwise "Condition:On get items count error" if requesting failed.
Sample capx
Get filtered items count by "Action:Get items count" after build a new filter. The result is put at "Expression:LastItemsCount" under "Condition:On get items count complete", otherwise "Condition:On get items count error" if requesting failed.
Related objects
Sample capx
Other item in table could be linked into a cell of current item.
Sample capx
Other item in table could be linked into a cell of current item.
Save linked object
Call "Action:Link to object" to link to another item at a key of current item. This linked item could be placed at other table.
Call "Action:Link to object" to link to another item at a key of current item. This linked item could be placed at other table.
Read linked object
Linked object would not be fetched automatically, Call "Action:4. Get linked object" to force this request to read this linked object back.
After read completed under "Condition:On received" or "Condition:On load by itemID", get the value of linked object by "Expression:CurItemContent", or "Expression:Index2ItemContent". "Expression:LastFetchedItemContent" by a specific key.
Field of this key would be split by "." -
Linked object would not be fetched automatically, Call "Action:4. Get linked object" to force this request to read this linked object back.
After read completed under "Condition:On received" or "Condition:On load by itemID", get the value of linked object by "Expression:CurItemContent", or "Expression:Index2ItemContent". "Expression:LastFetchedItemContent" by a specific key.
Field of this key would be split by "." -
- The 1st field is the key name of current read item which has linked object. i.e. it points to a linked object.
- The 2nd field is the key name in this linked object.
- Get linked object from the key "objectA" of current read item, then
- Get value at key "name" in this linked object.
Instance of request
Designer could create a new instance for each request. Or place multiple rex_parse_itemtable object for each different kind of request.
Designer could create a new instance for each request. Or place multiple rex_parse_itemtable object for each different kind of request.
Sort or filter data at local
Sample capx
Items read from parse could be put into rex_taffydb object by "Action:Insert JSON data" (rex_taffydb) with "Expression:ItemsToJSON" ((rex_parse_itemtable). Then user could sort or filter these items at local by this rex_taffydb object.
Sample capx
Items read from parse could be put into rex_taffydb object by "Action:Insert JSON data" (rex_taffydb) with "Expression:ItemsToJSON" ((rex_parse_itemtable). Then user could sort or filter these items at local by this rex_taffydb object.