stack function pipeline using results from previous step
Options
![mohan ramanujam](https://us.v-cdn.net/6037124/user_avatars/4156573.jpg)
mohan ramanujam
Member ✭
[FireShot Capture 105 - Xano - x8ki-letl-twmt.n7.xano.io.png]I am creting a DB function stack. First function does query all and searches on two fields other than the id field and returns the results in a variable. I want to then check to see if I have one or more results from the previous step (i am using has db function) and then I want to update a field. I am doing all this a patch API. How do I get step 2 to look at results from step 1 and then step 3 to update a particular field from previous step if step 2 is true.
Comments
-
You can reference the results of previous steps using the variable that you named the result.
For instance, you named the result/output of step one "profile_media_step_1_results".
So, now you can access that array of data anywhere else below that in your function stack. You can use Dot Notation to access the properties of the variable.
For instance, if you wanted to use the ID from step one, to edit the record in step 3, it would look like this:[Screen Shot 2022-04-23 at 11.45.33 PM.png]Side note, unless you want some other branch logic if the record does not exist, you probably want to use a precondition where you have your Has Record function.. Set the precodition so that it checks to see if the result of step one is null. If it's null (did not locate a record), then exit the function.
Then, continue to step 3. Also, make sure that step 1 only ever returns 1 record and that you have the output of step 1 set to "single". If not, you are going to return an array.
[Screen Shot 2022-04-23 at 11.52.06 PM.png]Your function stack could look something like below. [Screen Shot 2022-04-23 at 11.53.31 PM.png]
Precondition[Screen Shot 2022-04-23 at 11.55.41 PM.png] -
Thank you so much.
-
i am noit using has but precondition, conditionals and got things working nicely.
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