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

  • /attachments/1319433598583181423/1319433598855806986/image.png

    alain

    26 days 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!
    image.png
    image.png
  • Tom Ireland

    26 days ago

    Hey, Alain. What is the initial value of the workoutData variable? It looks like an object key/value pair without a value.
    ๐Ÿ™Œ1
  • /attachments/1319433598583181423/1319439719268089866/initial_value

    alain

    26 days 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.
    image.png
    image.png
  • inital value

    {
    "workoutName": "",
    "Exercises": [
    {
    "key": null
    }
    ]
    }
  • Tom Ireland

    26 days 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.
  • alain

    26 days ago

    I see! okay will try that out, thanks for the help!
  • ๐Ÿ™
  • Tom Ireland

    26 days 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.