← servoy magazine

[Tip] JAUSF #1 (Just Another Unknown Servoy Feature)

  • Tips

by Enrico Arata

Probably this little feature has existed for a couple of releases!!! Did you ever noticed that methods sample data are context aware?

What do I mean by "context aware?" In the Servoy method editor move the sample code for the function "controller.loadRecords" and you will see what I mean:

//Load records can be used in 4 different ways
//1) to load a (related)foundset
forms.servizio_agenzie_recapito.controller.loadRecords(order_to_orderdetails);

//2) to load a primary key dataset
//var dataset = databaseManager.getDataSetByQuery(...);
//forms.servizio_agenzie_recapito.controller.loadRecords(dataset);

etc etc....

What is "strange" with this sample code.... WELL... "servizio_agenzie_recapito" is not the form I'm working on, but it is the form from where I requested to "fire" the loadrecord!!! If I ask to move the sample from the same form I'm working I'll get:

//1) to load a (related)foundset
controller.loadRecords(order_to_orderdetails);

//2) to load a primary key dataset
//var dataset = databaseManager.getDataSetByQuery(...);
//controller.loadRecords(dataset);

etc etc....

Quite smart, isn't it? Thanks a lot Servoy DEV team!!!