Create custom fields

Top  Previous  Next

It is possible create custom text fields by using a layout template. Let´s see an example which you can download from this link

 

First of all, you will need to create a new Database with the new text fields. You can do it by following the menu 'Database/Create Database/Advanced/Load' and select the XML which is on the file that you downloaded above (or you can add the new text fields that you want). This will add two new text files ('Project Name' and 'Analysis Comments') to the Database. Click on the 'Create&open' button to generate the new Database:

 

custom DB

 

Then, you will need to create a layout template (in the example the template is called "LayoutOrig.mnova".

 

Here you can see a layout template with 5 pages (molecule, 1H-NMR, 13C-NMR, 2D-NMR and MS):

 

layout DB

 

Then, run the script called "addNamedFields.qs". This will add two named text fields [ProjectName] and [Comments] to the layout:

 

addNamed

 

Then save the results as "LayoutWithFields.mnova" by following the menu 'File/Save As'. Those text fields will have its own Properties, even you could add new text properties to the page items and edit them by selecting the 'Metadata' tab:

 

Text Properties

 

Finally apply the layout template over your datasets, fill the text fields manually and save the documents to the Database (by following the menu 'Database/Save').

 

To display the new custom fields after a search, go to the DBBrowser and add the new fields to views as desired and save the configuration by following the menu "Configure/Save Settings As":

 

Custom fields

 

You can create mandatory fields in order to save them to the Database, You will find an example script called "dbMandatoryFieldsExample1.qs" into the examples installation folder of Mnova. Save this script into one of your 'Scripts directories' (File/Preferences/Scripting), restart Mnova and then create a new database with two added custom fields "Project" and "NotebookRef" in the Molecule item type:
 
mandatory fields

 

Next, save any dataset to the new database and a dialog asking for the content of the mandatory fields will be shown with each save operation:

 

mandatory fields_2

 

 

You can also include fields in the DB Browser with hyperlinks. To do it, make sure that you create a database with an editable TEXT field; for example, the "Link" field in the Molecule item.

 

link_DB

 

Next, save some records in the database and open the DBBrowser to configure a widget to show the new column with the display mode as HTML:

 

DB_Browser_link

 

Then, write the HTML hyperlink tag:

 

DB_Browser_link2

 

and you will get the expected hyperlink:

 

DB_Browser_link3