Adding specific data to record only once when 1st object in list is created π§

Fredk
Member β
[
{"type": "preface", "body": "some paragraph"},
{"type": "chapter_1", "body": "some paragraph2"},
{"type": "chapter_2", "body": "some paragraph3"},
{"type": "chapter_3", "body": "some paragraph3"}
]
My function stack adds one record (1 object at a time), then queries all records. But I need to add the preface content only once, when a new book is created. Anyone knows how to do this, maybe with a "conditional" variable?
Tagged:
Answers
-
Seems like you need to query records beforehand to check if preface one is already there. If you are having a loop for adding the objects then you most likely want to check it outside of itso you are not making the query during every iteration.
You can query with exists type that return a true or false depending on the existence of a particular records. Based on that you can create a conditional to add the first object with preface if the query is false.
Hope that helps
Categories
- All Categories
- 46 π£ Announcements
- 47 π¦Ύ Releases
- 36 π Welcome
- 924 π€· Help! I'm a Noob
- 113 π± No-Code Front-Ends
- 597 π Working with APIs
- 418 π’ Transforming data
- 120 π Connect Xano to ...
- 46 π§βπ» Find an Expert
- 320 βOther questions
- 32 π Security
- 22 βοΈ Snippets
- 19 π Showcase
- 7 π£οΈ ο»Ώ Xano Chatter
- 60 πΊ Video Tutorials
- 166 π Request a feature
- 219 π Report a Bug
- 19 π Templates & Extensions
- 6 π¬ Feedback