{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"Incrementing / Decrementing Custom Parameters","type":"basic","slug":"incrementing-decrementing-custom-parameters","excerpt":"","body":"[block:callout]\n{\n  \"type\": \"success\",\n  \"body\": \"Please make sure that you're familiar with the [Running the Pulsate SDK](https://pulsate.readme.io/v2.0/docs/running-the-pulsate-sdk) tutorial.\"\n}\n[/block]\nThe Pulsate SDK allows you to store integer and float values as custom parameters against a given user. For example: *number_of_transactions = 100, number_of_points = 100.1*. We also give you the ability to increment / decrement these values.\n\nIt's useful in situations where you want to increase a value without knowing it beforehand.\n\nFor example, if you want to increment an integer counter you should invoke the *incrementIntegerAttribute:withInteger:* method on *PULPulsateManager*.\n\nIncrementing:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[pulsateManager incrementIntegerAttribute::::at:::\\\"number_of_transactions\\\" withInteger:1]\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"pulsateManager.incrementIntegerAttribute(\\\"number_of_transactions\\\", withInteger: 1)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nThis will increment the counter named number_of_transaction by 1, if counter is incremented for the first time, it will be created and initialized with 0 as the value,  and then incremented by 1.\n\nDecrementing:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[pulsateManager decrementIntegerAttribute:@\\\"number_of_transactions\\\" withInteger:1]\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"pulsateManager.decrementIntegerAttribute(\\\"number_of_transactions\\\", withInteger: 1)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nThis will decrement the counter named number_of_transaction by 1, if counter is decremented for the first time, it will be created and initialized with 0 value, and then decremented by 1.\n\nAll counter operations are stored locally and synchronized with the Pulsate server when synchronization occurs.","updates":[],"order":7,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5e5013741b3b2000653294a3","category":{"sync":{"isSync":false,"url":""},"pages":["5e5013741b3b20006532949e","5e5013741b3b20006532949f","55781fe45129590d003ff519","5e5013741b3b2000653294a0","5e5013741b3b2000653294a1","5e5013741b3b2000653294a2","5e5013741b3b2000653294a3","5e5013741b3b2000653294a4","55781fe45129590d003ff51f","55781fe45129590d003ff520","55781fe45129590d003ff521","5e5013741b3b2000653294a5","5e5013741b3b2000653294a6","5e5013741b3b2000653294a8","5e5013741b3b2000653294a9","5e5013741b3b2000653294ad","5e5013741b3b2000653294ae","5e5013741b3b2000653294af","5e5013741b3b2000653294b1","5e5013741b3b2000653294bc","5e5013741b3b2000653294be","5e5013741b3b2000653294c2"],"title":"iOS SDK","slug":"ios-sdk","order":1,"from_sync":false,"reference":false,"_id":"5e5013741b3b200065329487","version":"5e5013741b3b20006532951d","__v":11,"createdAt":"2015-01-05T12:43:51.897Z","project":"54aa7f773b56130b0056c86e"},"createdAt":"2015-05-18T11:36:27.596Z","githubsync":"","__v":7,"project":"54aa7f773b56130b0056c86e","parentDoc":null,"user":"54aa7f3f9bb00c0b00cb899b","version":{"version":"2.7","version_clean":"2.7.0","codename":"iOS SDK","is_stable":false,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["5e5013741b3b200065329486","55781fe35129590d003ff4f9","55781fe35129590d003ff4fa","5e5013741b3b200065329487","5e5013741b3b200065329488","5e5013741b3b200065329489","5e5013741b3b20006532948a","5e5013741b3b20006532948b","565b66c446118c0d00dcb0bb","56898269f8dc340d00308c13","5e5013741b3b20006532948c","5e5013741b3b20006532948d","5c73dd27e8fdc000572a206a","5e5013741b3b20006532948e","5e53d9a2f75c0b0020de8935"],"_id":"5e5013741b3b20006532951d","project":"54aa7f773b56130b0056c86e","forked_from":"5e4fbbbda8fb41028f1861fe","__v":1,"createdAt":"2015-06-10T11:30:42.700Z","releaseDate":"2015-06-10T11:30:42.700Z"}}

Incrementing / Decrementing Custom Parameters


[block:callout] { "type": "success", "body": "Please make sure that you're familiar with the [Running the Pulsate SDK](https://pulsate.readme.io/v2.0/docs/running-the-pulsate-sdk) tutorial." } [/block] The Pulsate SDK allows you to store integer and float values as custom parameters against a given user. For example: *number_of_transactions = 100, number_of_points = 100.1*. We also give you the ability to increment / decrement these values. It's useful in situations where you want to increase a value without knowing it beforehand. For example, if you want to increment an integer counter you should invoke the *incrementIntegerAttribute:withInteger:* method on *PULPulsateManager*. Incrementing: [block:code] { "codes": [ { "code": "[pulsateManager incrementIntegerAttribute:@\"number_of_transactions\" withInteger:1]", "language": "objectivec" } ] } [/block] [block:code] { "codes": [ { "code": "pulsateManager.incrementIntegerAttribute(\"number_of_transactions\", withInteger: 1)", "language": "swift" } ] } [/block] This will increment the counter named number_of_transaction by 1, if counter is incremented for the first time, it will be created and initialized with 0 as the value, and then incremented by 1. Decrementing: [block:code] { "codes": [ { "code": "[pulsateManager decrementIntegerAttribute:@\"number_of_transactions\" withInteger:1]", "language": "objectivec" } ] } [/block] [block:code] { "codes": [ { "code": "pulsateManager.decrementIntegerAttribute(\"number_of_transactions\", withInteger: 1)", "language": "swift" } ] } [/block] This will decrement the counter named number_of_transaction by 1, if counter is decremented for the first time, it will be created and initialized with 0 value, and then decremented by 1. All counter operations are stored locally and synchronized with the Pulsate server when synchronization occurs.