Update API not working

Options
I am creating a custom API to respond to Webflow's single webhook for form submission.  The payload gets delivered to the custom API.  The update uses a conditional statement testing for the form name and when the form name matches the code executes the CRUD operation.
The id in Xano tables is of type integer but in API builder they are "text" but reads as an integer.  The value of the id in a Webflow form as submitted is JSON (therefor text). I am "filtering" them both "to_int" in Xano.  

For some reason, when the form name matches the text value in the conditional, it is not executing the code as I might expect.
The "data" node (webflow) is presented as myJson below
[int types.jpg][update artist.jpg]
the variable "updated":false indicates the code to update was not executed.

Comments

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    David, from the screenshot, I think the "id" is not from your data source, but rather a raw text of "id". Can you re-pick from the drop-down to make sure its properly pulling from the input or what have you?
  • David Richardson
    Options
    Ray

    I did check that - if I understood your comment correctly.[2022-03-19_comment to Ray.jpg]White box shows "data"
    Green box shows "data.0.xanoID" and I create xanoID at the top of the stack[2022-03-19_comment to Ray 02.jpg]And note that the API input is "data" (not "myJson").  But what is still a mystery is that the "formName" variable is listed as "updateArtist" (shown in "myJson")
    [2022-03-19_comment to Ray 03.jpg]and the condition is set up thus
    [2022-03-19_comment to Ray 04.jpg]Here I've got single quotes, but I tried double quotes and back ticks with no joy in any of these that might NOT fire the code inside the if statement.
    Here's the JSON from webhooks.site
    [2022-03-19_comment to Ray 05.jpg]
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
     I believe you want to do that comparison without the quotation marks at all.

    Also, in the original post, I see that the field name is converted "to_int" - is that still there? The integer value of "id" would be something not-quite-right and never quite match the way we would hope.

    API logic is complicated! You're making great progress. 
  • David Richardson
    Options
    Ray Deck I did find some errors in my setup.  I'd filtered up the field_name "id" "to_int" (== 0) as WELL as field_value (xanoID) "to_int" == 14 (integer).   14 != 0.  
    But still the "formName" variables in the "if" statement was not working properly.  I created a new API starting from scratch.  That conditional with the same parameters DID work.  Surprise?!
    A noob doesn't know what they're doing.  Give  me a hammer and I'll destroy an iron ball.  Give me technology and I'll hurt myself.
    So starting from scratch seems the best path forward.  I can clone the conditional statement that is working (and change out the form names in each clone) and move on.