Change table name in JChemWebServices?

User e4183f4538

03-03-2010 21:47:59

Is there an easy way (or any way) to change the Database Table Name?


My particular case: In looking at structure tables under the Entity properties tab in InstantJChem, the Display name has been changed to 'Final Compounds', but the original imported Database Table Name remains 'COMPOUNDS'. While the deployed shared project will show 'Final Compounds' as the table name, the table will still appear as 'COMPOUNDS' in the JCWebServices Ajax dropdown menu.
How do I change the table name so it is reflected in the Web Services?


Changing the name on the MySql side looses any connection, but I can't find where to change this so that JChem understands.


Thanks!

ChemAxon ebbce65bcf

04-03-2010 08:11:46

Hi,


Now the only way to create such a "virtual" name in the Ajax example is if you change the Javascript code. Fortunately, this change affects only a few lines. To do this you should find the line


View.setSelectOptions('tSelection', Logic.tables, false, Logic.slcted); 

in view.js (inside initController() function), and change it to the following:


var tables = [];
for (var i = 0; i < Logic.tables.length; i++) {
   if (Logic.tables == 'structures') {
      tables.push('DisplayedTableName');
   } else {
      tables.push(Logic.tables);
   }
}
View.setSelectOptions('tSelection', tables, false, Logic.slcted);

This example assumes that you have a database table called 'structures' which you want to substitute to 'DisplayedTableName'. You can change these and you can define here other virtual table names using further "else if" statements after the first "if" condition:


else if (Logic.tables == 'originalTableName') {
   tables.push('virtualTableName');
}

I hope I could help.


Regards,


Roland