Referencing a variable in a formula breaks after triggering a formula that appends to that variable

  • buildingintoddle-1319433598583181423

    alain

    3 months ago

    If you see the screenshot workoutData at the top of the image is "undefined" and upon refresh it is defined again. Whenever I append to a variable, does there need be a refresh that needs to take place before the event can happen again? Not sure if im explaining this correctly, any help is appreciated!
    1319433598855806986-image.png
    1319433599459524718-image.png
  • tomthebigtree-1319438675397968002

    Tom Ireland

    3 months ago

    Hey, Alain. What is the initial value of the workoutData variable? It looks like an object key/value pair without a value.
    πŸ™Œ1
  • buildingintoddle-1319439720245366794

    alain

    3 months ago

    initial value is this

    and then i have this event from this button that logs data .

    it works for when i press the button once, it is able to append an exercise completed to a sort of workoutLog object to keep track of an entire workout. However there is going to be the second exercise to append, but then it basically doesn't work after one click event. Essentially what id want is to be able to log as many exercises as possible that is dynamically appending an array, then once the entire workout is complete i can send to the backend.
    1319439719754367046-image.png
    1319439720039841893-image.png
  • inital value

    {
    "workoutName": "",
    "Exercises": [
    {
    "key": null
    }
    ]
    }
  • tomthebigtree-1319440237805703289

    Tom Ireland

    3 months ago

    Ah, okay. Cool. I’d remove the object in the array, so it’s just set to an empty array and then append the object to the array.
  • buildingintoddle-1319440692325515374

    alain

    3 months ago

    I see! okay will try that out, thanks for the help!
  • πŸ™
  • tomthebigtree-1319441132517589062

    Tom Ireland

    3 months ago

    No worries.

Stop scrolling. Start building.

toddle is a visual web app builder that rivals custom code β€” but accessible to your entire team!

Try toddle β€” it's free!

Β© Copyright 2024 toddle. All rights reserved.