Rollbase [4.0.5] New feature: Service Object supports count

Posted by cSocaciu on 20-Jan-2016 08:55

Hello,


There is a new option in Rollbase 4.0.5 "Service Object supports count operation". Does anyone know how to use this ?

We implemented a count method on the object that Rollbase uses. I've also updated the Rollbase object but the check-box is not enabled in Rollbase.


Thank you in advance!

All Replies

Posted by Anoop Premachandran on 20-Jan-2016 08:57

It will be enabled when the JSDO catalog lists getCount as a possible operation..

Posted by Anoop Premachandran on 20-Jan-2016 09:01

Typo in earlier response It should be count and not getCount..

Posted by Anoop Premachandran on 20-Jan-2016 09:08

Can you share the JSDO catalog ?

Posted by cSocaciu on 20-Jan-2016 09:08

i have the following code generated in the JSDO file:

               "operations": [

                   {

                       "path": "?filter={filter}",

                       "useBeforeImage": true,

                       "type": "Count",

                       "verb": "get",

                       "params": []

                   },

However updating the Rollbase object with this  JSDO catalog file does not enable the option.

Posted by cSocaciu on 20-Jan-2016 09:12

The full catalog file:

{
    "version": "1.2",
    "lastModified": "Wed Jan 20 17:09:44 EET 2016",
    "services": [{
        "name": "rollbaseService",
        "address": "\/rest\/rollbaseService",
        "useRequest": true,
        "resources": [{
            "name": "siCountry",
            "path": "\/siCountry",
            "autoSave": false,
            "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {"dsCountry": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {"ttCountry": {
                        "type": "array",
                        "items": {
                            "additionalProperties": false,
                            "properties": {
                                "_id": {"type": "string"},
                                "_errorString": {"type": "string"},
                                "rowid": {
                                    "type": "string",
                                    "ablType": "CHARACTER",
                                    "default": "",
                                    "title": "rowid"
                                },
                                "rowstate": {
                                    "type": "string",
                                    "ablType": "CHARACTER",
                                    "default": "",
                                    "title": "rowstate"
                                },
                                "SortOrder": {
                                    "type": "integer",
                                    "ablType": "INTEGER",
                                    "default": 0,
                                    "title": "SortOrder"
                                },
                                "CountryId": {
                                    "type": "integer",
                                    "ablType": "INT64",
                                    "default": 0,
                                    "title": "Address Country Id"
                                },
                                "CountryCode": {
                                    "type": "string",
                                    "ablType": "CHARACTER",
                                    "default": "",
                                    "title": "Country Code"
                                },
                                "ShortDesc": {
                                    "type": "string",
                                    "ablType": "CHARACTER",
                                    "default": "",
                                    "title": "Short Desc"
                                },
                                "Description": {
                                    "type": "string",
                                    "ablType": "CHARACTER",
                                    "default": "",
                                    "title": "Description"
                                },
                                "Archived": {
                                    "type": "boolean",
                                    "ablType": "LOGICAL",
                                    "default": false,
                                    "title": "Archived"
                                }
                            }
                        }
                    }}
                }}
            },
            "operations": [
                {
                    "path": "?filter={filter}",
                    "useBeforeImage": true,
                    "type": "Count",
                    "verb": "get",
                    "params": []
                },
                {
                    "name": "submitsiCountry",
                    "path": "\/SubmitsiCountry",
                    "useBeforeImage": true,
                    "type": "submit",
                    "verb": "put",
                    "params": [{
                        "name": "dsCountry",
                        "type": "REQUEST_BODY"
                    }]
                },
                {
                    "path": "?filter={filter}",
                    "useBeforeImage": true,
                    "type": "read",
                    "verb": "get",
                    "params": []
                },
                {
                    "path": "",
                    "useBeforeImage": true,
                    "type": "update",
                    "verb": "put",
                    "params": [{
                        "name": "dsCountry",
                        "type": "REQUEST_BODY"
                    }]
                },
                {
                    "path": "",
                    "useBeforeImage": true,
                    "type": "create",
                    "verb": "post",
                    "params": [{
                        "name": "dsCountry",
                        "type": "REQUEST_BODY"
                    }]
                },
                {
                    "path": "",
                    "useBeforeImage": true,
                    "type": "delete",
                    "verb": "delete",
                    "params": [{
                        "name": "dsCountry",
                        "type": "REQUEST_BODY"
                    }]
                }
            ]
        }]
    }]
}

Posted by Anoop Premachandran on 20-Jan-2016 09:23

operation name should be count and type should be "invoke"

Example

"operations": [

{

       "name" : "count",

       "path" : "/getCount?filter={filter}",

       "type" : "invoke",

       "verb" : "get",

       "params" : [ ]

} ,

Posted by egarcia on 20-Jan-2016 09:28

Hello,

Could you try defining the count method as an invoke operation using the JSON Filter Pattern?

See the following link to the documentation:

documentation.progress.com/.../

The Rollbase documentation suggests that you need to enable the the usage of the count operation by selecting the corresponding property in the object definition.

I hope this helps.

This thread is closed