Question

Creating a field in a detail

Hi guys!

How do I create a field the value of which will display the final value of a certain field in a detail?

File attachments

Like

1 comments

Hello Malcolm!

You can perform query in the method handler and set the value in callback function

var select = Ext.create("Terrasoft.EntitySchemaQuery", {rootSchemaName:"InvoiceProduct" });

select.addColumn("Id");

select.addColumn("Invoice");

select.addColumn("TotalAmount");

select.filters.addItem(select.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "Invoice",

    this.get("Id")));

select.getEntityCollection(function(response) {

    if (response && response.success) {

        for (var i = 0; i < response.collection.collection.items.length; i++) {

            this.set("MyAmount", this.get("MyAmount") +response.collection.collection.items[i].values.TotalAmount);

        }

    }

}, this);

This is the example for invoice section. MyAmount is a summing field, TotalAmount is a detail field.

Show all comments