This guide explains how to configure the OI OData Adaptor, create a dataset query, add parameters, and display the results on an Explorer page.
Before you begin, make sure you have:
-
- Access to IFS OI Core Management, with rights to create datasources.
- An Explorer workspace where you can create a page.
1. Create the OI OData datasource
You only need to do this once per server. One datasource can hold as many datasets as you like.
- Open IFS OI Core Management and click the Configuration icon.
- Select Datasources from the middle panel, then click Create New Datasource.
-
Fill in the fields:
Field Value Name OI OData (or any name you like) Description Queries Explorer's own data through OData Data Type Dataset Adaptor OI OData Adaptor Time Zone UTC. OI OData returns times in UTC. Request Timeout Leave the default (1 minute) to start with. Raise it if large queries time out. -
The adaptor has no Adaptor Parameters. There is no server, database or password to enter: the adaptor always queries this server, signed in as the user viewing the page.
- Click Save.
2. Write your first dataset query
After saving, click Create one now to add a dataset.
- Enter a Name, such as Assets - Wells, and a Description.
-
In the Query Editor, type:
Entities?$filter=startswith(Name,'WELL-')&$select=Name,DisplayName,Latitude,Longitude&$orderby=Name
-
Click Save.
The query text is the part of an OData URL after /odata/. The adaptor adds the server address for you, so don't include https://... or /odata/.
This dataset returns one row per well, with four columns:
| Name | DisplayName | Latitude | Longitude |
|---|---|---|---|
| WELL-A12 | Alpha 12 | -20.3121 | 118.6012 |
| WELL-A14 | Alpha 14 | -20.3150 | 118.6033 |
Tip: Change 'WELL-' to match your own asset naming convention. If you're not sure what your assets are called, start with Entities?$select=Name,DisplayName&$top=20.
3. Add a parameter
A parameter lets the page user choose a value. Here's a dataset that lists Sentinel events on a chosen asset, since a chosen time:
- Add another dataset to the same datasource, called Sentinel - Events for Asset.
-
Enter this query on one line:
SentinelEvents?$filter=Entity eq ODataParam(asset,string) and StartTime ge ODataParam(since,datetime)&$select=Entity,MonitorName,SeverityName,StartTime,EndTime,Value&$orderby=StartTime desc&$top=500
-
Core Management detects the two ODataParam keywords and lists asset and since as parameters. Give each one a default value, such as WELL-A12 and a date a week ago.
- Click Save.
ODataParam writes the value in the right OData format for you. Text gets its single quotes and dates are written as ISO 8601 UTC, so don't add quotes around the keyword yourself. See Parameters.
4. Show the dataset on a page
- Open Explorer Studio and create or edit a page.
- Add a table (or a chart or map) control.
- For its data, choose the OI OData datasource and then your dataset.
- For the parameterised dataset, link asset and since to page variables so users can choose them.
- Save the page and view it.
The page runs the query as the person viewing it. Sentinel events aren't filtered by Explorer security, so every viewer sees the same events. Objects such as entries, workbooks and tags are filtered by the viewer's access.
5. Try your queries in a browser
Before you save a dataset, it's quickest to try the query in a browser. Sign in to Explorer, then open:
https://<your-oi-server>/<service-root>/odata/<your query>
For example:
https://oi.example.com/oi.core/odata/Entities?$filter=startswith(Name,'WELL-')&$select=Name,DisplayName&$top=10
Your administrator can tell you the server and service root. The browser shows the JSON the dataset will be built from, and if something's wrong, the full error message.
To see every object and field OI OData offers, open .../odata/$metadata, or see the Object Reference.
6. Five rules for OI OData datasets
- Write the query on one line, starting with the object name. No https://, no /odata/, no GET.
- Return flat rows. Use $select to pick plain columns. Don't $expand related objects in a dataset. To include a related value such as a workspace name, compute it as its own column instead. See Getting related values into a dataset.
- Stay under 1,000 rows. A dataset reads one page of results, which is at most 1,000 rows. Filter, use $top, or aggregate on the server.
- Use ODataParam for parameters, not PARAM. The SQL keywords PARAM, PARAMS, SORTBY, FIRSTROW and LASTROW don't work with this adaptor. To page a dataset, use ODataSkip() and ODataTop() in $skip and $top. See Parameters.
- Count and group on database-backed objects, such as EntryRecords instead of SapiCases, or TagDefinitions instead of Tags. They have no 5,000-row cap.