Get totals of connected thing

I´ve been playing with the app itself and cannot make this:

  • I´ve a thing called invoices and here a field called “total”
  • And a thing called invoices_lines and here some number fields

I want to connect those two because inside an invoice itself there needs to be invoices_lines. I don´t really know how this works as I came from a relational database and there you´ve an object and then you connect that object to a child object.

Then what I need to do is on the invoices thing on a field called “TOTAL” to get the totals of the invoices_lines of that invoice.

And lastly I was wondering how to achieve a conditional rule on a particular field. In the database I´m used to play you go to the field and set the conditional rule that it´s just working in the backend itself not seeing by the user. Something that happens just on the database.

For example: if the field 1 is more than 3, set this field to “Right” if it´s less, set to “Wrong”.

Thanks a lot.

1 Like

You can do conditions in the Workflow “squad/block”, above where actions can be added.

About relation between “things”, you can create a element thats a list of another elements (ex. clients, and a list of clients). There you can do a search for clients:count

Maybe that can help.

Thanks @csfalcao,

But what I need is to have a connection of invoices to invoices_lines for example:

  • I´ve an invoice that has many invoices_lines like a regular invoice.

So I want to get a sum of all the invoices_lines connected to an invoice particular field.

1 Like

You can create a field at the invoice level that is a list of invoice lines and the calculate the sum from it. So in a repeating myself group, for instance, you could say

Current cell’s invoice’s list of invoice lines’ amount:sum

Thanks a lot @emmanuel, that should work.

Also related to this thread, about the list of “something”. That´s limited to 1.000, right?

For example: when a client has a lot of invoices (it could be more than 1.000), would you choose to connect “client” thing with “invoice” thing, a list of …?

Well you can also attach the invoice to a user, and then search for all invoices whose user is the current user, and that limit won’t matter.

Thanks @emmanuel,

The data structure will be this one (things): User > clients (could be more than 1000) > invoices (could be more than 1000) > invoices_lines (less than 1000)

So, know I don´t know when I´ve to chose the checkbox of it´s a list or even if it does matter when connecting those things.

Would you mind helping with this choice?

Thanks.

1 Like