Add to existing value without getting a record?
Options
![Valentin R](https://us.v-cdn.net/6037124/user_avatars/4304535.jpg)
Valentin R
Member ✭
Hey! Was wondering if I can use "Edit record" function to do some maths on an existing value, without pulling out a record prior to this.
E.g. there is a record with a value that counts a number of sent emails. Every time I send another email, I want to increment that value. Doable with just "Edit" or I have to pull the data first?
I know it sounds weird, but I am just learning.
E.g. there is a record with a value that counts a number of sent emails. Every time I send another email, I want to increment that value. Doable with just "Edit" or I have to pull the data first?
I know it sounds weird, but I am just learning.
Comments
-
Hey - if you want to add to something that already exists then yes you will have to first get the data and update it.
So in your case if you are doing math on an existing value, then you will always want to first get the existing value and apply your math to it then update the value in the database. -
Hello, I am having a similar issue here.
I am attempting to increment an existing variable; however, when using Get Record and then incrementing the value using Edit Record, I receive an error message stating "Unable to locate var: photo_activity.total_likes". Any assistance would be appreciated!
[increment likes issue in Xano - error msg.PNG][increment likes issue in Xano.PNG]
-
- unable to locate var means that your variable at that path does not exist. This could be because there is a typo or you don't have a value at that path...
If it is the latter then you want to use the GET filter in lieu of dot notation so you can define a default value (perhaps 0 if you are doing math) - https://docs.xano.com/working-with-data/dot-notation#get-filter -
Thank you for your quick response! Got it working with the GET filter![increment likes in Xano - Working!.PNG]
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback