Is there an effective way to update variables once set? For example:
In the beginning of a flow, set a variable "myvariable" as a whole number - such as 10
prompt ai command - perform a basic task, set to search for up to three people at a time, up to a maximum of the "myvariable" count
decrease variable "myveriable" by the number of people returned
reach condition:
Condition A: If variable is >0, return to 2
Condition B: If variable is 0, print message and complete flow/exit
If, for example, the myvariable was initially set to 10, and each search successfully returned up to 3 people, it would cycle 4 times. Cycle 1: Return 3 people, reduce variable to 7 Cycle 2: Return 3 people, reduce variable to 4 Cycle 3: Return 3 people, reduce variable to 1 Cycle 4: Return 1 person, reduce variable to 0, reach condition loop completion criteria I swear I used to be able to do this by setting a variable again with the same name, however it seems to then create a new variable, hence I can't continually refer to a variable that should be updated in-place. I'm thinking of using memory instead, but I'm guessing somehow I'm misusing variable because it's supposed to be able to ... vary. This isn't the only thing I need to update on the fly - other variables would be lists of names, etc. I can commit and read these from a google sheet as an option but as lists grow I believe this may become "expensive" - whether model costs or context management in general.
Do you have an example task that I can take a look at what your current set up looks like? Or have you not set anything up yet? 🙏
https://chat.lindy.ai/jeffrey-thompsons-workspace/lindy/24-recurse-loop-6867d698f088de99157a157c/editor - I haven't configured the condition fork because I can't seem to figure out how to update a variable that doesn't seem to declare a new one. The intent is to update the Count and Exclude variables and return to the Perplexity prompt that refers to their initial values (as a variable).
Hi Jeffrey T. , I have previously done this using set variable and assigning the same name, although this was a few months ago. Confirming this no longer works? A few other solutions:
Use the add context feature where you initialize the variable with add context and you can use add context later in the flow to modify the Lindy's memory
I usually use xml tags like <variable_name>{value}<variable_name>
in the first add context I say add {insert xml tags + variable} at the top of your context w/ prompt mode
in all subsequent steps I instruct it in prop mode to modify the variable inside <variable_name> tags to {new value}
Can prompt to select/extract the variable in future steps to get the current state
Have a google sheets with a row/column for each variable name and use it to store variables. Can update row when you need to change
this solution is less fit if you are trying to run a Lindy in high volume
Yeah updating the variable worked when I tried this months ago so I'm guessing there's been some change in behavior. Can't use lindy context/memory as I'm trying to use a "manual" prompt which I don't believe I can pull from memory for unless I'm mistaken. Agree sheets is doable but is messy - I'd have to continually read and update. Doable, but externalizing simple variable management to a google sheet or database seems like it's inelegant for something that can best be done in-platform. I'm considering using a traditional loop and limiting concurrency to 1 which would still result in excessive updates and calls to sheets, but brings everything into Lindy's default loop behavior versus leveraging conditions. Easier to manage.
