Selecting from a code table while inside the form

User c1ce6b3d19

25-08-2012 00:12:35

I'm creating a form that has a status field on it.  I would like the following things to occur.



  1. Upon creation the user should be presented with a certain set of values that exist in a status code table in the DB.  

  2. When editing, the user should be able to change this value to another value from this set.  

  3. When editing, the user should be able to change a null value to another value from this set.  


I considered making a foreign key relationship between the root entity and this code table (basically a many to one from PARENT.status_id to STATUS.id).  After hooking up the fields on a form, I run into this error when trying to change the foreign key value.  


Field Status_ID cannot be modified as it is part of relationship (Internal error: DFRelationDataProvider should be used instead of DFEntityDataProvider)


Is this an appropriate error, or should I change the design of the relationship or form widgets?


 


I saw a recent forum post about Custom input forms.  It suggest using groovy to build a custom input (i.e. creation) form and it also suggested following this example to enable drop downs.  


http://www.chemaxon.com/instantjchem/ijc_latest/docs/developer/scripts/plcc.html


 Firstly, I believe the documentation page only has one script example, not two as described.  


Secondly, assuming we can write a full fledged custom layout for creation, would writing a groovy button script help us to do editing after creation?  That is, to do both presenting value from a code table and the ability to modifiy keys in a relationship?


 


Thanks,


Jon

ChemAxon fa971619eb

25-08-2012 14:53:22


I considered making a foreign key relationship between the root entity and this code table (basically a many to one from PARENT.status_id to STATUS.id).  After hooking up the fields on a form, I run into this error when trying to change the foreign key value.  

Field Status_ID cannot be modified as it is part of relationship (Internal error: DFRelationDataProvider should be used instead of DFEntityDataProvider)


Yes, this is a current limitation. You can't edit values that invovled in relationships as doing so would make the data somewhat inconsitent. We plan to remove this limitation in the future, but for now there is no simple soution.



http://www.chemaxon.com/instantjchem/ijc_latest/docs/developer/scripts/plcc.html /> Firstly, I believe the documentation page only has one script example, not two as described.  


Yes, looks like the second script never got added. We'll look into this.


Secondly, assuming we can write a full fledged custom layout for creation, would writing a groovy button script help us to do editing after creation?  That is, to do both presenting value from a code table and the ability to modifiy keys in a relationship? 

It would allow you to present the values and let the user choose one, but it would not let you change the value as this is prevented at the API level, as mentioned above. A workaround would be to delete the row and insert the data as a new row, but with the updated value for status.


Or possibly to do the edit directly with SQL and then refresh the data after the change had been made (not sure about the exact details here, but it should be possible).


Not sure if either of these would be suitable?


Tim