databaseManager.getDataSetByQuery(...)

Hello,

I have a query that works with controller.loadRecords(…) but will not work with databaseManager.getDataSetByQuery(…).

Is it correct that the databaseManager.getDataSetByQuery(…) will not take multiple WHERE clauses with the AND operator?

Anton Dorrestijn

Could you post your complete code?

You can use multiple where clauses and ANDs in your query, that is not the problem…

Basically, what you do is use getDataSetByQuery(…) to retrieve a dataset that you then load via controller.loadRecords(dataset).

It was my mistake, the databaseManager.getDataSetByQuery(…) wouldn’t load the records because it didn’t met the where clause. (note to myself: check that first next time…)

Funny part is that the controller.loadRecords(…) loaded the records even when the query should not find records with the given where clause…

Anyway, the getDataSetByQuery(…) is of no use to me, it doesn’t allow to create records. I wanted to use it to prevent the annoying “flickering” of the user interface.

Anton

anton.dorrestijn:
Funny part is that the controller.loadRecords(…) loaded the records even when the query should not find records with the given where clause…

Seems strange to us, if the query is wrong or has no results the form shows no records.
Are you sure the query is correct? and does not return results?

Seems strange to us, if the query is wrong or has no results the form shows no records.

Hi Jan,

I wil check it again and post my findings.

Anton

Hi Jan,

Just got the latest update of servoy and my wooden shoe is breaking :wink:

The controller.loadRecords( “querystring” ) is now returning:

Fout tijdens het laden van Primary Key data,The query does not have the correct number of pks in the select

While the databaseManager.getDataSetByQuery(…) now performs fine!

code used:

var _data = databaseManager.getDataSetByQuery( controller.getServerName(), _qry, null, 20 );
controller.loadRecords( _data );

It seems to me you do select more than the PK columns, pls verify all the conditions for the SQL as found in sample code/docs.

Hi Jan,

You’re right, not all cols are pk cols → corrected → it works now.

Anton