List of methods assigned to table events

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

List of methods assigned to table events

Postby abeermann » Wed May 16, 2018 10:44 am

Hello Everybody

I need a list of all tables from a server and all the methods which are assigned to the onAfterInsert and onAfterUpdate events from different solutions.
The result should be something like this:

table1 solution_x onAfterInsert = methodA
table1 solution_y onAfterInsert = methodB
table1 solution_z onAfterInsert = methodA
table1 solution_x onAfterUpdate = methodx
table1 solution_y onAfterUpdate = null
table1 solution_z onAfterUpdate = methodz

table2 solution_x onAfterInsert = null
table2 solution_y onAfterInsert = methodB2
table2 solution_z onAfterInsert = methodA2
table2 solution_x onAfterUpdate = null
table2 solution_y onAfterUpdate = method11y
table2 solution_z onAfterUpdate = method22z

I start with:
var allTabs = databaseManager.getTableNames(servername);
(this will be more than 500 tables!)

But how to continue?
Any help/example welcomed?
Best regards
Posts: 105
Joined: Fri Nov 26, 2010 12:46 pm

Re: List of methods assigned to table events

Postby Peter de Groot » Wed May 16, 2018 11:45 am


Run code below to get the table methods (I use the Usermanager plugin)

Code: Select all
function tableMethods() {
   var $i, $j, $k, $servers, $tables;
   $servers   = plugins.UserManager.Server().getDbConnectionInfos();
   for($i = 0 ; $i < $servers.length ; $i++){

   function getDbTables() {
      $tables   = databaseManager.getTableNames($servers[$i][0]);
      for($j = 0 ; $j < $tables.length ; $j++){
   function getTableMethods() {
      var $table = databaseManager.getDataSource($servers[$i][0],$tables[$j])
      var $method = solutionModel.getDataSourceNode($table).getMethods();
      if($method.length > 0){
         for($k = 0 ; $k < $method.length ; $k++){
            application.output('DB [' +$servers[$i][0]+'] TABLE ['+ $tables[$j] +']  METHOD [' + $method[$k].getName()+']');

This is the result,
DB [mneme] TABLE [additional_levels] METHOD [new_method]
DB [pbs] TABLE [_table_] METHOD [new_method]
DB [pbs] TABLE [iso] METHOD [onRecordInsert]
DB [pbs] TABLE [iso] METHOD [onRecordUpdate]


Peter de Groot
Posts: 215
Joined: Thu Jan 10, 2008 8:38 pm
Location: Not sure...

Re: List of methods assigned to table events

Postby abeermann » Thu May 17, 2018 5:16 pm

Hello Peter

Thank you for your quick answer, but no success?

I tried the following on a small test db:
function welcheTabellenMethoden() {
//var servername = 'maxdb';
var servername = 'pugbilder';
var alletabellen = databaseManager.getTableNames(servername);

var vmax = alletabellen.length
for (var index = 0; index < vmax; index++) {
var tabellenname = alletabellen[index];

/** @type {String} */
var tabellenDS = databaseManager.getDataSource(servername, tabellenname);
var tabellenMethoden = solutionModel.getDataSourceNode(tabellenDS).getMethods();

var vmmax = tabellenMethoden.length;
if (vmmax > 0) {
for (var mindex = 0; mindex < vmmax; mindex++) {
application.output('DB [' + servername + '] TABLE [' + tabellenname + '] METHOD [' + tabellenMethoden[mindex].getName() + ']');

[bilder, dokumente]

Application.output shows the tables, but no methods found.(no further output??)
What i wanted to find is in the attachment.
I need to find out, that the solution PUG_Default_Forms fires the method "notNullDefaultsSetzen" onRecordInsert and onRecordUpdate of table "bilder" .(screenshot).

screenshot.1.jpg (155.6 KiB) Viewed 803 times
Posts: 105
Joined: Fri Nov 26, 2010 12:46 pm

Re: List of methods assigned to table events

Postby mboegem » Thu May 17, 2018 5:44 pm

Hello Albert,

to get the methods on a datasource as in the example code, will return the methods as defined in the entity scope.
This will not return the methods bound to the database events as you requested.

AFAIK, there's no way to retrieve this programmatically, but if you do a search in Eclipse (ctrl-H) > tab "file search", you can at least extract a list with methodID's

You should search for the string 'on*MethodID' and set the filename pattern to *.tbl
The result should look something like this:
Code: Select all

I guess if you want to take this a step further, you can copy paste the result in a textfile and write a simple script to parse the unique methodID's from this file.

Hope this helps
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

User avatar
Posts: 1469
Joined: Sun Oct 14, 2007 1:34 pm
Location: Hoofddorp, The Netherlands

Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 6 guests