Custom input forms

User 9aa4619393

11-07-2012 15:32:55

Hi,


in one of our projects we have a requirement for a custom input fmask.


One issue with the standard input mask is the order in which the fields show up in the form. I have the impression that in a local database this depends on the order they have been imported in. In the case of projects with data in a remote Oracle database It seems random...I don't see how I can influence it. People usually have a certain logic they use  when they create a record, and they would like to follow a certain mental order. Also, some fields are used only seldom, and these should show up at the bottom. Another point is that they would like cascading drop-down lists: in one example, there is a list of buildings and a lists of rooms. They would like to select the building and then in the second drop-down only see the room numbers that are from that building.


Also, if the user is logged in, it would be nice to have the "entered by " field, pre-filled. Same thing for the "entered date".


Judging from some script examples that I have seen, it should be possible to create such a form using Groovy. This would require writing the whole mask  from scratch. I have seen some examples using SwingBuilder and it seems doable. The one thing I wouldn't know how to do though is adding Marvin Sketch to the form to allow drawing a structure, and then get the molecule from the sketcher into the Structure field. Do you have any examples of how to do this?


Another idea would be to misuse a regular form to create an input form. This would save a lot of work, in designing the mask but how would I get things like automatic filling the user id into "the entered by" field to work? And how about the cascading drop-down? Would this work at all?


I would appreciate if you could point me in the right direction, and if you could provide some sample Groovy code for adding Marvin to a Frame.


Thanks,


Anna

ChemAxon 60ee1f1328

12-07-2012 07:06:47

Also, if the user is logged in, it would be nice to have the "entered by " field, pre-filled. Same thing for the "entered date".


I think you could set column defaults or use triggers here, although care is required since your RDBMS and IJC user are different.

User 167db55417

12-07-2012 15:44:12










DanielSButler wrote:

Also, if the user is logged in, it would be nice to have the "entered by " field, pre-filled. Same thing for the "entered date".


I think you could set column defaults or use triggers here, although care is required since your RDBMS and IJC user are different.



Hi,


We had a simillar issue.


(Take into consideration that our setup is: mysql 5.5.x + "use database accounts".)


The DEFAULT value for a field is not an option, because you can set it only to a constant value.


 in BEFORE INSERT trigger for the table in question:


 


SELECT SUBSTRING_INDEX(USER(),'@',1) into NEW.entered_by from dual;


SET NEW.entered_date=CURDATE();

ChemAxon 60ee1f1328

13-07-2012 08:35:07


in one of our projects we have a requirement for a custom input fmask.


 


* please explain what an "fmask" is, it is a new term for me.


 


 


One issue with the standard input mask is the order in which the fields show up in the form. I have the impression that in a local database this depends on the order they have been imported in. In the case of projects with data in a remote Oracle database It seems random...I don't see how I can influence it. People usually have a certain logic they use  when they create a record, and they would like to follow a certain mental order. 


 


* I think your observation is correct but you can re-order in grid view by dragging and it will persist.


 


Also, some fields are used only seldom, and these should show up at the bottom. 


 


* Fields are effectively columns and if anything, would "age out" horizontal? But no age out mechanism exists.


 


Another point is that they would like cascading drop-down lists: in one example, there is a list of buildings and a lists of rooms. They would like to select the building and then in the second drop-down only see the room numbers that are from that building.


 


* Drop down lists are possible in groovy. You can see an example here:http://www.chemaxon.com/instantjchem/ijc_latest/docs/developer/scripts/plcc.html


 


Also, if the user is logged in, it would be nice to have the "entered by " field, pre-filled. Same thing for the "entered date".


 


* OK, so perhaps a simple RDBMS trigger is the best route here.


 


Judging from some script examples that I have seen, it should be possible to create such a form using Groovy. This would require writing the whole mask  from scratch. I have seen some examples using SwingBuilder and it seems doable. The one thing I wouldn't know how to do though is adding Marvin Sketch to the form to allow drawing a structure, and then get the molecule from the sketcher into the Structure field. Do you have any examples of how to do this?


 


* I don't think so, I have wondered this would be an interesting thing to try.


 


Another idea would be to misuse a regular form to create an input form. This would save a lot of work, in designing the mask but how would I get things like automatic filling the user id into "the entered by" field to work? And how about the cascading drop-down? Would this work at all?


 


* Table widget with relationship might provide the same filtering effect but I don't think there is a drop down widget type...


 


I would appreciate if you could point me in the right direction, and if you could provide some sample Groovy code for adding Marvin to a Frame.


 


* Personally I have not tried that yet, but I would be interested to so please bear with me whilst I try and gather info on how...


User 9aa4619393

06-08-2012 12:12:13

Hi Daniel,


thanks for your answers, and sorry for replying so late, I was on vacation.


"fmask" is a typo, I actually meant "mask".


You say:


'you can re-order in grid view by dragging and it will persist.


I don't understand what you mean...if I reorder the columns in grid view then when I create a new row the order of the fields is unchanged, and corresponds to the one I had in grid view before starting reordering.


>Also, some fields are used only seldom, and these should show up at the bottom.


>>* Fields are effectively columns and if anything, would "age out" horizontal? But no age out mechanism exists.


I don't understand what you mean here either. What I wanted to say is that users would prefer to be able to set the order of fields in the input form they use when creating a new row, one reason being that some fields/columns are used only seldom so they should show up at the bottom.


Looking forward to hearing what you find out


Cheers


Anna

ChemAxon 60ee1f1328

07-08-2012 09:45:25

Hi,


 


Please can you expand on what you mean by custom mask, do you mean custom filter for rows ?


(You can hide columns you do not wish to see visible)


"I don't understand what you mean...if I reorder the columns in grid view then when I create a new row the order of the fields is unchanged, and corresponds to the one I had in grid view before starting reordering."


I think you are refer to the order of fields in the add new row dialog which is apparently independent of the grid view ordering, but it might be a candiate for a change request to sync the two - I could not comment on how easy that would be to achieve. I think this explains the second small mis-understanding. You want to be able to arrange the vertical order of fields in add new row dialog.


 


Daniel.

User 9aa4619393

08-08-2012 11:52:26

Hi Daniel,


sorry about the confusion! It's  just my poor translation into english...I mean that I want to be able to set the vertical order of the fields in the dialog that pops up when I create a new row, so that people can follow the order they think most appropriate when entering data, instead of whatever order is dictated by the application. Yes, syncrhonizing the grid view with the new row dialog would be nice! That would already be a step forward.


Thanks


Anna


 

ChemAxon 60ee1f1328

10-08-2012 13:36:42

Not to worry Anna - your need for a bespoke input form is noted but I guess there is some preference to try and use the existing mechanism with new row dialog - I have placed a request to sync grid view and the new row order, although it may be more complex than this simple mental association.  If you really need a bespoke form, there are several of us who could get together and put together your GROOVY need - please contact Tim, if you need to arrange this doing.

ChemAxon fa971619eb

22-08-2012 07:58:35

I discussed this off-line with Anna. Summary:


Currently the best approach is to write a button script that provides a custom data entry form. The standard Insert row dialog would still be availalbe, but users would use the button on the form to launch the custom form instead.


In future you will be override the behaviour of the insert row button and so provide you own custom data entry form and validation etc. In 5.11 you will see the first of these custom hooks, but not yet the one needed for this.


Whichever approach is taken a custom data entry form will need to be programmed in Groovy.


Tim