Join the Webstudio community

Updated 2 months ago

Add Expression Editor to Variables

At a glance

The community members are discussing the ability to create variables using the values of other variables, particularly in the context of a resource URL or a query. Some community members express concerns about the complexity of implementing this feature, while others suggest using template literals or JSON in the request body as potential solutions. The discussion also touches on the use case of saving a value from a GraphQL request or other resource to a variable, which could be a time-saver. There is no explicitly marked answer, but the community members seem to be exploring different approaches to address the original question.

Useful resources
I'd like to create a variable using the values of other variables.

I think the only place this can be done is in the resource URL, but I'd like to do it with strings.

Thoughts?
Attachment
image.png
1
B
J
j
14 comments
What is your use case? We thought about it at first but decided to not implement because of huge complexity.
Assembling a query with a variable.

It's just a lot easier to send the full query, with values (e.g. the slug) then to send the query with a variable.
If it's a huge complexity, then not worth it right now
actually template literals may solve this
Especially if this is implemented then I can add the query to the URL field with template literals and not have to worry about encoding https://discord.com/channels/955905230107738152/1218751594489970849
If you mean graphql requests better use json in body { variables: {}, query: "" }
it can be parametarized just like url
btw requires Content-Type: application/json header
and post method
Ah cool I'll play with this and report back. And I'm not using graphql rather Groq which is a Sanity custom language.
Okay disregard. using post solves both this and the encoding. Thanks Bogdan!
I would love to see this now that we have the CMS. My use case would be to save the blog title in a variable that I can use multiple times.

At the moment I have to use Baserow.data.results[0].Name everywhere I need it. Feel like there should be a way to just create a variable for this
+1 for this. Being able to save a value from a GraphQL request or other resource to a variable would be a huge time saver
Add a reply
Sign up and join the conversation on Discord