Limit for selected rows?

Hello,

 

I'm trying to run a process for the selected records from a section. I've been using this example

and it's working.

https://academy.bpmonline.com/documents/technic-sdk/7-13/handling-selection-several-records-examples

The problem is that the collection I'm getting (from this.get("SelectedRows")) contains maximum 60 records, although I've selected more than 100 records.

Is there a records limit? Do I need to get the next records using other method?

 

Thank you,

Cristian Galatan.

 

 

 

Like 0

Like

5 comments

The records aren't getting loaded all at once, but by small parts while a page is being scrolled down in order to optimize the loading. 

In order to obtain all selected records in js code please explore how the same functionality was implemented in the action "Export to excel".

I have analyzed the code and found the following root method.

getSelectedRowsEsq: function() {

            const esq = this.getGridDataInitializedEsq(true);

            const selectedRows = this.getSelectedItems();

            const selectAllModeEnabled = this.$SelectAllMode;

            if ((!this.Ext.isEmpty(selectedRows) && this.$MultiSelect) || selectAllModeEnabled) {

                esq.filters.clear();

                esq.filters.addItem(selectAllModeEnabled

                        ? this._getSelectAllModeFilters()

                        : this.Terrasoft.createColumnInFilterWithParameters(this.primaryColumnName, selectedRows));

            }

            return esq;

        }

 

Alina Kazmirchuk,

Thank you Alina. I will check this.

Hi Cristian,



I am encountering the same. Have you found a way how to retrieve all the records from Select All?

Hello,

 

Try performing visa versa operation - get all records that are not checked when all records are checked and perform a mass operation.

 

IMPORTANT NOTE: we strongly don't recommend developing such a logic of mass actions (especially when a section contains millions of records) since your app can crash when triggering this logic.

 

Here is an example of a mass updateQuery executed for all records selected in the Opportunity section (button click event handler):

setAllDone: function() {
				var update = this.Ext.create("Terrasoft.UpdateQuery", {
                                rootSchemaName: "Opportunity"
                            });
				const unselectedItems = this.getUnselectedItems();
				if (!Ext.isEmpty(unselectedItems)) {
					unselectedItems.forEach(function(item) {
						update.filters.addItem(Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.NOT_EQUAL, "Id", item));
					});
					update.filters.logicalOperation = Terrasoft.LogicalOperatorType.AND;
				} else {
					const isNotNull = update.createIsNotNullFilter(Ext.create("Terrasoft.ColumnExpression", {columnPath: "Id"}));
					update.filters.addItem(isNotNull);
				}
				update.setParameterValue("UsrToUncheck", true, this.Terrasoft.DataValueType.BOOLEAN);
				update.execute(function() {
                            this.reloadGridData();
                        }, this);
			},

The filter is required anyway since when performing an update without a filter this message is received:

Note how the getUnselectedItems method was used there. It returns an array of records that are not selected in the list.

 

In your case you need to use the logic similar to the one I shared above.

Hello Oleg Drobina,

 

I just tried the suggestion below, it worked, but one point bothers me in the result...

 

I have 5000 contracts, via Créatio filters, I select 100 contracts.
I click on "Select all" in the "Actions" menu and I uncheck 10 records, 90 records are therefore still selected.


I would expect these 90 records to be updated, but it is in fact 4990 records that have been updated! (i.e. all my contracts except the 10 explicitly unchecked...)

 

Is this normal? How can I work only on my 100 previously filtered records?

 

An important point to note in what I am trying to do, the records that I select will then have to be transmitted as a "Collection of records" to a process.

 

Here is my current code which works fine if I loop through my entire grid of records before clicking my button running my code 

 

startContractsRevaluation: function() {
	var guidsArray = this.getSelectedItems();
 
	// Prepare the recordset with the "Id" parameter
	var contractArray = guidsArray.map(function(guid) {
		return
		{
			"ContractId": guid // Assign each GUID to the "Id" parameter
		};
	});              
 
	var args =
	{
		sysProcessName: "UsrPrepareContractRevaluation",
		parameters: {
							ContractArray: contractArray
					}
	};
 
	ProcessModuleUtilities.executeProcess(args);
}

 

Thank you Oleg

Show all comments