Custom Function
On this page you can create or update a Custom Function.
The Source Code can be C# or SQL and in either case valid Custom Function Code should be entered.
Checking Source Code for errors
You can validate the Source Code by clicking the button labelled 'Validate'. This will check that Medidata Rave considers the Source Code to be valid. Where possible the line(s) which have error(s) will be indicated with an error icon in the left-hand side bar.
Note
TrialGrid will use a recent version of Medidata Rave to validate the Source Code. It is possible that older versions of Medidata Rave validate Source Code differently (for example, having fewer restrictions on allowed C# methods). For this reason TrialGrid will allow Source Code with errors to be saved.
Keyboard shortcuts
The source code editor has keyboard shortcuts to assist with search and replace. The keyboard shortcuts are active when the cursor is inside the source code text area.
Ctrl-F / Cmd-F
Start searching
Ctrl-G / Cmd-G
Find next
Shift-Ctrl-G / Shift-Cmd-G
Find previous
Shift-Ctrl-F / Cmd-Option-F
Replace
Shift-Ctrl-R / Shift-Cmd-Option-F
Replace all
(Use the tab key to move between the Yes/No/All/Stop options)
Alt-G
Jump to line
Autocomplete
While editing C# Source Code you can display an autocomplete list using Control-Space (press and hold the Control key and then the Space key). This will display a list of allowed C# classes and methods taken from the Medidata Rave documentation
The autocomplete list will be filtered using the text to the left of the cursor. For example showing autocomplete for this C# code
DataPoint.Enter
will display an autocomplete list starting with:
DataPoint.Enter(string, string, int)
DataPoint.Enter(string, string, Medidata.Core.Objects.DataEntryState)
DataPoint.Enter(string, string, string, int)
You can use the scroll up and down the list using the mouse or keyboard. Typing more characters will filter the list further. You can select an item using the mouse or with the Tab key.
The method signatures are displayed in the autocomplete list but will not be inserted into the code on selection of an item.
Note
Classes and methods which are deprecated by Medidata and/or not supported in Medidata Rave EDC (RaveX) are highlighted in red.
Note
The autocomplete functionality is not 'intellisense'. It filters the list based on the text to the left of the cursor but does not analyze the code to work out class types. In the following code no autocomplete will be displayed because TrialGrid does not know that 'dp' is a DataPoint
DataPoint dp = afp.ActionDataPoint;
dp.Enter
Custom Function Length
The number of characters in the Custom Function Source Code will be displayed at the bottom right. Medidata Rave accepts a maximum of 8000 characters. Note that each line break counts as 2 characters in Medidata Rave.
Note
A warning symbol will be displayed next to the number of characters if the number of characters is less than, but close to the 8000 character limit. Sometimes Medidata Rave will not import Custom Functions which are close to 8000 characters in length.