DataField() Function

Author: Optuma Team Last updated: Jan 29, 2024 10:13

The DataField() function allows you use fundamental, Bloomberg data, or custom External Data Fields, in scripting formulas.

For example, to add a watchlist column to calculate the current PE ratio as a percentage of the 5 year average, add a new Script Column to the watchlist and type DATAFIELD in the editor window.

Click on the text to open the properties window, and then the Field option to see the list of data available. In this example, ‘pe ratio’ has been entered in to the search box and selected the 5 Year Average PERatio field:

DataField Function

By creating variables for both this and the current PE Ratio a formula can then be built to find the percent ratio between the two:

//Calculate the %
V1 / V2

DataField Function

Once added to a watchlist column it will calculate as follows, so Agilent’s current PE (21.4) is 54.6% of the 5 year average (39.15), whereas AAP is 127%:

DataField Function