stack function pipeline using results from previous step

Options
[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

  • Kevin Wasie
    Kevin Wasie Member
    Options
    

    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]
  • mohan ramanujam
    Options
    Thank you so much. 
  • mohan ramanujam
    Options
    i am noit using has but precondition, conditionals and got things working nicely.