Save an expression in a Field (in Data type)

You can always have a custom state that gets set to your text and use that in a text element… If you prefer.

Can you use the CSV import for the upload ?

1 Like

Another way to ask your question:

Can I apply Bubble’s dynamic expression parser to evaluate a dynamic expression stored in a text form?

1 Like
  1. Thank you! This “cosmetic” solution :wink: multiplies the essences. But if don’t have another variants I will be used this solution - thanks :slight_smile:

  2. Yes, import CSV or from Google Spreadsheets (across Blogspring or Zapier)

:confounded: Unfortunately not sure that I understood you, but your question looks like correct…

Sorry to dump those technical phrases on you like that!

A “parser” is a program which reads expressions and does something with them, replacing them with calculated values.

The process of giving the expression to the parser is called evaluation, i.e. giving a value to it.

What you are asking for is to store little pieces of programs into data. Some programming languages like perl and javascript can do this. @josh is probably the best able to answer if it is worth doing in Bubble.

1 Like

Well, the poor man’s way of doing this is to use the “:find and replace” function. That won’t let you save an arbitrary expression in the database, but it’ll let you evaluate a set of pre-specified expressions. You can do things like save the expression: “Hello, [NAME], welcome to [CITY]”, and then replace [NAME] + [CITY].

As for truly saving arbitrary Bubble expressions and then evaluating them, we certainly can’t do that today… in theory, I could imagine this working (Bubble expressions are all JSON under the hood, and we have the ability to store JSON data in our database…), but we’d have to build some stuff to make it work in practice – it’s probably not a very generally useful feature, but it might be fun, I’ll think about it…

3 Likes

Yes, most likely this is what I need.
… and now I will try other options.
Thank you.

Hi Guys,

thread is 5 years old but im curios if theres any update. I have a situation where i need to build an app with many recurring expressions. So it would be great if I could make the expression some kind of reusable. If I add a specific new function to the app, where i need to restructure this expression, it would be nice to change it in one place and not in many places over the app, where for sure, I need to find all first.

Any hints on that?

Best regards

1 Like

Hi!

I’m also interested in this topic, even its more than 5 years old.

I’m looking for a solution for my SaaS, where my users should be able to create a text (in this case a contract) template, where they can insert dynamic data tags. I’ll give you a contract example where the brackets should be the dynamic data the user should be able to insert in the text editor:

[Company name] at [Company adress] , hereinafter referred to as: ‘the lessor’,

and

[First name] [Last name] born on [Date of birth], hereinafter referred to as: ‘tenant’,

Have agreed:

Article 1. The rented,

The landlord rents out to the tenant the non-independent living space, hereinafter referred to as ‘the rented property’: [Street name] [House number] [Location of object], [Name of space].

Hopefully someone can help :slight_smile:

1 Like