[TIP] Save searches with Servoy 3
The dynamic dev-team just introduced a very powerful, new feature in Servoy 3RC1: now it's possible the get the SQL used by Servoy to generate a foundset using two instructions (databaseManager.getSQL and databaseManager.getSQLParameters).
Why it's so powerful? Well: did you ever wonder how nice would it be to have a quick way to store user's searches? Now it's possible with very little effort.
Just put a onSearch method that grabs the SQL and the related parameters, like:
controller.search()
//get the SQL of the current foundset
globals.SQLPark = databaseManager.getSQL(foundset)
globals.SQLParamsPark = databaseManager.getSQLParameters(foundset)
After that, you can load this foundset whenever you want, just using:
controller.loadRecords(globals.SQLPark, globals.SQLParamsPark)
Of course, this is just an example. You may want to build a more articulate procedure, that stores the saved searches in real columns and not in global fields and so on...
Enjoy.
Comments (5)