Formulas playground

I’m struggling a lot to progress in my development because I can’t find a way to test formulas and see what a certain formula returns. If I show the result of a formula in a view and the result of the formula is not consistent with the view type, or the there are some problems with the formula, then the whole app breaks and I can’t check whats wrong with my function.

It would be nice to have a sort of playground where you can see what the function returns and play with it. Does anyone have any solution to this problem?

Hi you could use a few options.

The standard way to test an expression is by tapping on the test link in a an expression ( AppSheet’s standard terminology for a formula :slightly_smiling_face: ) entry pane. The Expression Assistant flags almost all of syntactical errors.

If the expression is flagged as good by the expression assistant, you could click on the Test link to know what results it is producing.

The test pane will show the results

You can even expand the test results to see how the expression got evaluated in steps

If an app is breaking because the formulas do not match and does not load you will need to find the problem and first fix it so your app loads. Look for the red dots which highlight where an error is.

If I need to check the result of a formula, or to split it up into different sections to check the values at different stages, I use virtual columns. Type the required formula into the virtual column and create a new view showing the data that you need to inspect with these virtual columns included. Once you are happy with it all, delete the view and the virtual columns.

Virtual columns have the benefit of calculating immediately and when deleted or added, they do not mess with your data structure. A preference of mine is to prefix the name of all virtual columns with "VC - " so I know immediately that it is a virtual column rather than a “normal” column.

I also have two testing apps that only I have access to. These contain all types of random data and formulas and graphs but as they are for testing I can add and remove tables, data and formulas without breaking my main apps.

thank you guys for the answers.

Coming from the javascript world I’m used to console.log() my way out of bugs or use some of the many js playgrounds available to test functions or small scripts. I’ve already been using virtual columns to view results but its impossible to debug large functions in this way.

I also find the “test” option quite useless since if there is an error nothing shows.

I was just wondering if anyone knew about some tool available similar to a javascript playground or to “console.log()”.

There is none.

I’ve already been using virtual columns to view results but its impossible to debug large functions in this way.

How so? Maybe we can offer some tips.

In the sense that if you are building a slightly complex formula in a vc you are stuck with some generic error messages and its very difficult to debug the formula when you cannot check what the different parts of the formula return.

Its just very limiting not having a proper playground or tools for formulas and it takes a very long time for someone learning the sintax where the bugs are.

I’m thinking of switching to microsoft powerapps, it looks like the tools and documentation is much better there but I might be wrong.