Totals column link to a total field

Hi everyone, how can I link the sum total of a column in a field form? As the snippet below, I wanted to fetch the sum total in a total pricing field. Thanks for the assistance :slight_smile:

Sorry, just found out how to do it, kinda? Is it correct? :slight_smile: I used the sum type to sum the total column.
image

Yep @RONALD - that’s correct, just us a formula in the parent record and sum the child line items so you can show in the parent details view. :+1::100:

1 Like

Hi @CarlHolmes, seems that I did something wrong with the sum type as it wasn’t matched on the total column. How can I fix this? Thanks :slight_smile:

Here’s my schema.
Parent


Child

@CarlHolmes seems that it is a bug. I delete details on my table and refreshed data and it worked :slight_smile:

Hey @RONALD - you have inadvertently answered your own question :blush:

If you delete a line item the page doesn’t refresh the total in the parent details. You need to do a manual refresh to pull through the revised total. You may be able to achieve the details page refresh in code but I’m not a coder.

Allowing deletions is something I would highly recommend you avoid. Too many times in my career I’ve had calls from clients telling me that records have “disappeared” and that the database is deleting records. Humans will delete things by mistake.

It can also leave you orphan records as Knack does not conduct cascading deletes. For example. If you deleted a product from a product list, all the related sales line items would no longer have a connection and be orphaned and not display, although, they would still be in the line items table in the builder, just not connected to anything. Allowing critical deletes to parent records can be devastating to the integrity of any application.

If you need to remove line items I’d recommend doing a soft delete / archive. I have created the below video which shows you how this can be used to achieve the result you are looking for, without code.

If you needed to permanently delete the records I would do this with Integromat running on a schedule so it deletes all line items marked as “Yes”. The video doesn’t go into the Integromat step but this can easily be created. Not sure if you are an Integromat user.

1 Like

Hi, I have come across this thread as I am trying to generate a field that summarises total values of a specific field, does the sum function still work on Knack or has this been removed. I don’t see this facility in the knack builder, what I am trying to achieve isn’t workable with the equation function.

Appreciate any help on this

If you are trying to add together fields from the same object then use an equation field and use the field names.

For example {unit price}+{margin}

If you already have records and add the equation field later, it is unlikely to show the result immediately until the formula fields updates on AWS, which can take a few minutes.

You can force a refresh, if required, by editing a record in the table and submitting, just click into a field and submit. This will force a record update and the formula field will show the result. This is the quickest way to test that it’s showing the expected result.

The video I posted above is for summing related line items in another table.

1 Like

@CarlHolmes thanks for this :slight_smile:

1 Like

Thanks for this :+1:

1 Like