Join the Webstudio community

Updated 2 months ago

How to write looping in Expression Editor

At a glance
The post asks "How do we write better of this?". The comments discuss ways to simplify the code, such as using value || ' ' or value ?? ' ' instead of a loop. Community members also mention a guide on the expression editor and suggest integrating AI to help write expressions using natural language. There is no explicitly marked answer.
Useful resources
How do we write better of this?
1
B
A
O
8 comments
There is no looping though your can can be simplified
Plain Text
(baseRowData...[0].value ?? "") +
(baseRowData...[1].value ?? "") +
(baseRowData...[2].value ?? "")
so we'll just do it like this ?

is there a guide on how to write the expression editor?
a guide like this maybe?
https://jquery.timothyricks.com/
Attachment
CleanShot_2025-03-10_at_11.00.482x.png
In this particular case you can just do
value || ' ' or value ?? ' '
the difference is
'' || ' ' === ' ' and '' ?? ' ' === ''
@Adam Muflihun our expressions are just javascript expressions without method calls, tell this to AI and it will most likely write you any expression
then you would probably replace the variables with your baserow specific variables
Now that there are no IDs on copy, its much easier to give AI your entire expression and be able to paste it back in to Webstudio πŸ™‚
also is on the todo list https://github.com/webstudio-is/webstudio/issues/4869 where we can integrate AI and let you use natural language while AI writes the expression
Add a reply
Sign up and join the conversation on Discord