Skip to content

DataField() Function

By Optuma Team · Updated 2024-01-29

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:

V1 = DATAFIELD(FEED=FD, FIELD=PERatio, LATESTONLY=True);
V2 = DATAFIELD(FEED=FD, FIELD=5YearAveragePERatio, LATESTONLY=True);
//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

Choose which categories of cookies you allow. Strictly-necessary cookies are always on. You can change this any time via the "Cookie Settings" link in the footer.

  • Functional

    Remember preferences like dismissed banners and your dark-mode choice.

  • Analytics

    Help us understand how the site is used so we can improve it.

  • Marketing

    Measure our advertising and help us reach people who may be interested in Optuma.