# OpenClinica User Manual/FindingOIDs
## Two ways of finding the OpenClinica-ID's (OID's) for a rule
### Ingredients for a rule

When you want to construct a rule for a CRF, you're going to need four OpenClinica ID's or OID's as ingredients:
* the OID of an event
* the OID of a CRF-version in that event
* the OID of a group in that CRF
* the OID of an item in that group
You can access this information via two completely different routes:
* using the StudyMetaData-file
* using the OpenClinica-application
If you are familiar with XML-formatted files and you can find your way around in your study, choose the first option. If this is one of the first times you are using the OID's, chose the second option.

### Using the StudyMetaData-file

Login to OpenClinica as Study Director and click on "Tasks". Choose from the list that appears "Study setup", "View study".
In the first line screen that appears (Download all of the OIDs needed for Data Import and Rules in the ODM XML File format by clicking here.) you find the link to the StudyMetaData-file
Clicking on this link will start the download of a compressed file. The name of this file is the name of your study, plus the date and time the file was generated, with extension .txt.zip. Unzip this file and rename it to extension .xml. Now you can open it, preferably in an XML-editor.
If you have looked at a StudyMetaData-file before, you will notice that this is just a simple version of it. For this example I threw out a few hundreds of lines and left only the relevant ones.
We are looking for four OID's and they come in pairs:
* in the StudyEventDef is a reference to the form
* in the ItemGroupDef is a reference to the items
In the two red circles you'll find all the information you need to build your rule:
There is however one last thing to consider: the OID for the group has an extra extension in the StudyMetaData-file: in the example above this is ItemGroupOID="IG_SF36_UNGROUPED-F_SF36_15". So the OID of the form is appended to the OID of the ItemGroup. To use this GroupItem OID you must not use the extension!
| Study event OID | : SE_ENDOFSTU |
| CRF version OID | : F_SF36_15 |
| Group OID | : IG_SF36_UNGROUPED |
| Item OID | : I_SF36_GH01 |
Thus the target for your rule would be : <Target Context="OC_RULES_V1">SE_ENDOFSTU.F_SF36_15.IG_SF36_UNGROUPED.I_SF36_GH01</Target>
You can now start writing your rules. But below is another way to find OID's.

### Using the OpenClinica-application

Here is an alternative for finding the OID's. It uses the OpenClinica-interface. We'll walk through step by step and you will get the same results as the when using the method described above.
Login to OpenClinica as Study Director and click on "Tasks". Choose from the list that appears "Study setup", "Build study".
Click on the magnifier-icon in step 3 "Create Event Definitions".
You now see a list of all the events in your study and for this example we'll use EndOfStudy. Click on the magnifier-icon of this event.
Now a screen opens, displaying information about the event and about the CRF's in that event. Here you can find your first ingredient: the OpenClinica ID (OID) of the StudyEvent, in this case "SE_ENDOFSTU". Write this down for later use. Then click on the magnifier-icon on the right of the CRF you want to use for your rule.
In the screen that opens you see the CRF-details, including the OID of this version of the CRF: "F_SF36_15". Again: write this down, because this is your second ingredient.
Now click on the strange icon on the right to view the meta-data of the CRF.
This next screen gives you both the OID of the item and of the group this item belongs to: ingredients 3 and 4.
As described above you can now define the target for your rule: <Target Context="OC_RULES_V1">SE_ENDOFSTU.F_SF36_15.IG_SF36_UNGROUPED.I_SF36_GH01</Target>