controller.loadRecords(id)

I add records to a foundset and add the id to an array. Later I use that array to print the forms based on that array. I do the following for that. Unfortunately the foundset is bigger than what I defined. What do I do wrong:

var dataset = arguments[0]; //taken from another foundset into the method
var ID = new Array(dataset.getMaxRowIndex()); //define array

for (var i = 1 ; i <= dataset.getMaxRowIndex(); i++)
{
	if (i > 1)
		controller.duplicateRecord();	//I duplicate this record if i > 1
				
	ID[i-1] = lettersid; //add the id to the array
}

forms.lettersPrint.controller.loadRecords(ID); //call form/records based on arry
forms.lettersPrint.controller.print(false, true);//print records

I checked the dataset and the ID array. They both have 3 records in there but printing gives me all records…

What you are trying todo is not possible (but might be a good idea to build)
Move sample code of loadRecords(…) to see all possibilities of use

first convert the ID’s to a dataset:

var set = databasemanager.convertToDataset(ID);

and use that set in youre load

:oops: Should/could have know! Thanks guys ‘problemo solvado’…

Well, it looks like there still is an issue. Instead of:

forms.lettersPrint.controller.loadRecords(ID);
forms.lettersPrint.controller.print(false, true);

I now have:

var set = databaseManager.convertToDataSet(ID);

forms.lettersPrint.controller.loadRecords(set);
forms.lettersPrint.controller.print(false, true);

This gives me a set of 2 selected records where the array (ID) and dataset (set) contain 3 records (I doublechecked this)!!!

When I now do:

var set = databaseManager.convertToDataSet(ID);

forms.letters.controller.loadRecords(set)
forms.lettersPrint.controller.loadRecords(foundset);
forms.lettersPrint.controller.print(false, true);

Where the form letters is the original form on which I created the array…
The result is the expected 3 records?

Do I do something wrong or is this a bug?

this could als be youre code yes?

var set = databaseManager.convertToDataSet(ID); 

controller.loadRecords(set) 
forms.lettersPrint.controller.loadRecords(foundset); 
forms.lettersPrint.controller.print(false, true);

(so you are in the context of the letters form.. )
To be sure that you set the same foundset…

what does the maxRecordIndex say when you load the records?

Below my factfinding mission:

Here I load the set into the basic form and load the foundset into the print form. All goes well…

controller.loadRecords(set) 
//controller.getMaxRecordIndex result = 3
forms.lettersPrint.controller.loadRecords(foundset); 
//forms.lettersPrint.controller.getMaxRecordIndex result = 3

Here I don’t do a controller.loadRecords() and the foundset = 2. I only print two records…

//controller.loadRecords(set) 
//controller.getMaxRecordIndex result = 2
forms.lettersPrint.controller.loadRecords(foundset); 
//forms.lettersPrint.controller.getMaxRecordIndex result = 2

Here I again don’t do a controller.loadRecords() and the foundset is again 2. When loading the set (and not the foundset) into the print form I again have 3 records but can only print 2???

//controller.loadRecords(set) 
//controller.getMaxRecordIndex result = 2
forms.lettersPrint.controller.loadRecords(set); 
//forms.lettersPrint.controller.getMaxRecordIndex result = 3

In all cases I didn’t use a seperate foundset (check in print form) and checking the print form to use a seperate foundset doesn’t change the result.

Could you check the default sort on your forms, one of must be using a related field sort with one field being null in the database (and is due to db join for sort not returned)

Hai Jan, thanks for your effort! Just wanted to tell you that…

In this case I don’t use any (default-) sort on both the forms. So that can’t be the issue… I have attached the properties of the forms. Left is the ‘basic’ form right = the ‘print’ form.

we are unable to reproduce this at all, can you sent us your solution or provide a small sample which shows this?