Calculation on Table View

I have a DB View that contains

  • a column from table A that is a number called maximum slots
  • another column that is a count of a related table’s rows sessionCount.

Maximum slots is the maximum amount of students a tutor is allows.
The count of session rows is a tutor’s actual active students at this given point in time.

Is there a way to add a column that provides a calculation between the two ie. sessionCount - maximum slots?

I know that if both maxslots and sessionCount were simple properties, I can create an addition column with a number operation. But is there any way to have this subtraction as an automatic column when sessionCount is actually a count of rows in a related table?

The objective is to calculate “remaining capacity” of a tutor. It happens today that sessionCount is higher than maxslots as in the screenshot, and I want to see when this happens so I can prevent it in the future.

Hello @Andreas_Marinopoulos

Take a look at the Generated Columns feature Functions and Examples of Generated Columns | Backendless

So that is only possible for columns of a table, not a view. My problem is that one of the “values” I need in the generated column is a count of rows in a related table. Is there any way to make that work?

So that is only possible for columns of a table, not a view.

Oh, yes it’s supported only for DataTables, not for DataViews.

My problem is that one of the “values” I need in the generated column is a count of rows in a related table. Is there any way to make that work?

No, you can not refer to relations in the generated column.