Calculated Fields in Data Collections

Often when you work with data and fields a lot of fields needs to be calculated, just like you do in Microsoft Excel or a Google Sheet. Wouldn’t it be awesome if you could accomplish that in Wix Code?

Lets say I create a new field in my Data Collection and I choose Calculated Field as the field type. Then I can write formulas inside a value editor as I can in Airtable. =SUM(FieldKey+FieldKey2) and then the resulting value will be the sum of those two fields.

This way non-programmers would be able to do a lot more with ordinary Data Colllections and with no scripts inside.

If I then have a reference between two Data Collections I would be able to get data from the other data collection and sum with fields in the first one. This would power up the use of Data Collections.

Just a thought.

7 Likes

Yes this would be very useful.
e.g I have the following app I need to develop for a client.
They want a simple Donation-by-project solution (header and detail as per invoice design)
Header contains the project description information and target amount.
Detail contains each donation received.
Calculation/Totaling of all donations for a project and to show against target value on page in a graph etc.

Yes this is definitely what I would like to code!

I am trying to incorporate the same calculation for my other clients to total up their payment for a donation.
Also how can we export this data collection? It would be helpful to export this data by a download button!!

Thanks for all you are doing wix. Big fan of this product!

You can make a downloadabe file pushing data to a html component and in that trigger the download.

I guess there is no way of doing this at the moment?

You have to use data hooks to achieve this.