Question

Filtration

Hi Guys,

Please, i need help debugging this code. I was trying to read the value of Location to filter.  After filtration, i want t count the number of rows return to display a message.

save: function() {

                var message = "";
                var accountId =  this.get("Location").Name;
                var esqAdd = Ext.create("Terrasoft.EntitySchemaQuery", {
                    rootSchemaName: "AccountAddress"
                });
                esqAdd.addColumn("Address", "Address");
                esqAdd.addColumn("AtsVerified", "AtsVerified");
                esqAdd.addColumn("AccountId", "AccountId");
                
                var esqFilter = esqAdd.createColumnFilterWithParameter(
                    Terrasoft.ComparisonType.EQUAL, "Account.Id", accountId);
                esqAdd.filters.add("esqFilter", esqFilter);
                var esqFilterSec = esqAdd.createColumnFilterWithParameter(
                    Terrasoft.ComparisonType.EQUAL, "AtsVerified", false);
                esqAdd.filters.add("esqFilterSec", esqFilterSec);
                // Get entire record colelction and display it in an infor window.
                esqAdd.getEntityCollection(function(result) {
                    if (!result.success) {
                        // error processing/logging, for example
                        this.showInformationDialog("Data query error");
                        return;
                    }
                    result.collection.each(function(item) {
                        //if (item.Count > 0) {
                        message += "Account ID: " + item.get("Account.Id") + "Account Address: " + item.get("Address") +
                        " - Is Verified: " + item.get("AtsVerified") + "\n";
                            //message = "You need to verify all addresses";
                        //}
                    });
                    this.showInformationDialog(message);
                }, this);
            }

File attachments

Like

2 comments

Hi, Adebola!

I`m not sure what exactly you meant by "Location", do you have a field named Location, which contains AccountId? If you meant the location in the address bar(id of the current record), you can get it using this.get("Id").  Also, you probably want to check if result.count > 0.

What king of help do you need? Please put a breakpoint on every record and theck the system behaviour.

Show all comments