how to modify javascript to get the cd_id value

User c1ae849bfe

03-06-2010 17:42:24

Hi,


   I
was using chemaxon suite to build a database webpage like http://www.chemaxon.com/ajax/.
However, I have some problems when I want to extract some information from the
results of the webpage. When the public user searched my database using this
webpage, it will give the results containing columns, No, Structure, ID,
Formula and Molweight. As a server, I need to get the ID value to correlate
with my other data resource. But I do not know how to modify the javascripts used
by http://www.chemaxon.com/ajax/ to
get the ID value which in database should be cd_id column. Is there any method
to get this value when the public user did their searching?


  
Thanks a lot!


 


Wei Li


2010.06.04

ChemAxon ebbce65bcf

04-06-2010 14:09:54

Hi,


I don't know which version you are using, but there should be a


getRowField: function(rowNumber, columnName)


function in logic.js, which does the trick. Unfortunatelly in some 5.3.x versions this function returns wrong values. If you experience this, I can send you a patch, or a suggestion how to fix the code.


Regards,


Roland

User c1ae849bfe

11-06-2010 08:12:13

Dear Roland,


  Sorry for replying you so late…...Before I
reply you, I have tried it many times……Yes, my version is 5.2.4. Thanks very much for
your kind suggestion. I have tried this method, but I felt that these
javascripts are so complicated. I did not know how to use getRowField: function(rowNumber, columnName)
this function to output the cd_id value. Can it output the cd_id
value to a file.txt or something else which I can read it using my perl cgi
script? And when I delete this function in logic.js, the webpage still works
well and I do not kown why. Could you give me some suggestions? 


 


Wei Li


2010-6-11

ChemAxon ebbce65bcf

15-06-2010 14:50:11

Wei Li,


I don't suggest you to remove the getRowField function. :) The application will throw an exception in case it cannot find that. These kind of  errors are usually shown by your browser. Your application still worked, because this function is called only when you click on edit buttons, as I remember, so if you remove this function, only the editing functionality will go wrong. Anyway I provide you some examples for the usage of getRowField:


var id = Logic.getRowField(0, 'cd_id') ;   // will get the cd_id value of the first row of the spreadsheet


var id = Logic.getRowField(2, 'cd_formula');   // will get the cd_formula value of the third row of the spreadsheet


Maybe you should also try uppercase CD_ID and CD_FORMULA, if you get empty values back (the 5.2.4 code should handle the different cases, but I don't remember exactly). You can print the result values with:


alert(id);


Fortunately (or in your case unfortunately) JS does not have access to your file system, so you cannot write this value to a local file directly. However, you can use an applet (signed java or flash) which gets this value from the js, and does the file system operations you want. Or you could write a PHP (or Perl) script, which saves the given input content to the server, and the JS would call this PHP (or cgi) with the value of getRowField. So what you want is possible, but not that easy. I hope I could help.


Regards,


Roland

User c1ae849bfe

22-06-2010 01:38:50

 


Dear Roland,


    Thanks  for your help! I have tried your suggestion and It works!


 


Wei Li


2010.06.22