loadRecords / showRecords behavior change in 3.5?

Testing 3.5 with our current solution and have a strange problem.

We’ve used navigational global methods all over our solutions like this:

var fs_fv_record = fs_invoiceid

var dataset = databaseManager.convertToDataSet(fs_fv_record);
application.setStatusText(fs_fv_record)

forms.fs_invoice_main.controller.showRecords(dataset)

This works fine in 3.1.6, but in 3.5 it doesn’t work.

Following the method in the debugger, it:

  1. Sets fs_fv_record correctly
  2. converts to dataset correctly (JSData set size = 1, selected row = -1)
  3. Shows the forms
  4. Form has no records.

We’ve tried using a loadRecords then a show, but this doesn’t work either.

If we use a showRecords or loadRecords using a relation - loadRecords(relation) - it works fine.

Is there some reason forms in 3.5 will no longer load a dataset created by convertToDataSet ?

What would be another good method to load a single record using a PK? We’d rather not use scripted FINDS.

(need to use PK’s, not relationships as some have multiple children and we only want the one to load)

Thanks for any information or help!

NCM
FSCI

Hi,

The function convertToDataSet() requires an array. So just put your variable between square brackets like so:

var dataset = databaseManager.convertToDataSet([fs_fv_record])

And it should work.

Hope this helps

Interesting.

So 3.5 + it must be an array? Previously, you could just use a PK (even a literal) in there.

Perhaps it was never supposed to work when not in array form but did by default :slight_smile:

Thanks for pointing that out Roclasi.

Anyone else use other methods to generically load a single record?

Servoy should implement a loadRecords method that will accept the PK of the table the form is based on - all these double-firing of queries or converting of datasets just to load a particular record is inefficient.

I’ve seen this requested before and was surprised I haven’t seen it in 3.5 when I started testing. Or am I missing it somewhere?

Thanks!

NCM
FSCI

The converting process of an array to a dataset does not involve queries and should be super fast. So except for a bit complex handling to get the desired result this is not really a problem.

Good to know.

I’ll continue using this method then - and just make sure all objects are arrays from now on.

Thanks for the feedback.

NCM
FSIC