Skip to main content
Question

Set a string variable to the currently set value (not the default) + another string


Assen_Tzekin

Hi,

Does anyone know if the following is possible:

Set a string variable to the currently set value (not the default) + another string.

For example. I have a frame and text, the text is chained to a variable and it has a default value=What do you want? Then I have two buttons that when pressed will set some string to that variable, button 1=ice cream , button 2=coke. I want to check and if the variable string equals the default value of “What do you want?” either button to set the corresponding string value, else to append the string value to what is currently set?

Thank you

This topic has been closed for comments

2 replies

y_toku
Figmate
  • Community Support
  • 2419 replies
  • April 2, 2024

Hi there,

Thanks for reaching out. I made a sample prototype to see if I am understanding correctly.

It seems we currently doesn’t support interactive variables or conditional logic in the way Unfortunately, it seems Figma currently does not support interactive variables or conditional logic in the exact manner you described. However, I attempted to create a workaround. As shown in the prototype, you can add some strings to the variable in this manner.

Please note that the item count is in a separate frame, allowing me to apply a different logic to it.

I hope it helps but please let me know if my understanding is correct or not and add some important missing points!

Thanks,
Toku


Assen_Tzekin
  • Author
  • New Member
  • 4 replies
  • April 2, 2024

Thank you @y_toku , hopefully this will be added to variables, in the meantime I will try to find a workaround.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings