---
title: Advanced Syntax Options
slug: help/en-us/dairycomp/commandline-adv
docTags: 
createdAt: 2026-01-26T11:43:19.539Z
---

Expand the topics below to learn more:

:::ExpandableHeading
## Add Codes

When entering codes (such as vet codes or event codes) in the command line to generate a report, you must use the code's numeric value, not its alphabetical name.

**For example:** Enter **EC=5** in your command line for BRED events. Why? Because "EC" is the abbreviation for event codes, and 5 is the event code for BRED events. You would NOT enter **EC=BRED** or just BRED.

This syntax holds true for all types of DairyComp codes (i.e., reproduction codes, breeding codes, etc.).
:::

::::ExpandableHeading
## OR Conditions

One way to include two different groups of animals in the same report is to group your item parameters within parentheses. This type of syntax is commonly called an OR condition, since you are requesting "this **or** that" data. For example, you can request data from one pen or another pen:

<font color="#6b7280">      **&gt;100**</font> <font color="#EAB308">**(****=1** **&gt;60) (****=4** **&lt;50)**</font>

The first part of this command produces a list in which all the animals are at least 100 days in milk. However, the **OR** conditions—those parts of the command in parentheses—specify which pens those animals must be in and how much milk they had to produce.

You can also combine different types of data with **OR** conditions. For instance, if you want to create a list of animals for potential culling, you could identify animals according to the following criteria:

- Open more than 150 days and not pregnant , or...
- Bred more than three times, or...
- Milking less than 40 pounds and least 100 days in milk

In this case, your report command might look like this:

<font color="#6b7280">        **&gt;1**</font> <font color="#EAB308">**(****&gt;150** **=0) (****&gt;3) (****&lt;40** **&gt;100)**</font>

:::ExpandableHeading
**Things to consider when using OR conditions**

- <font color="#67854E">**OR**</font> conditions must be placed within paired parentheses.
- &#x20;conditions used in the command must be placed before the OR condition.
- <font color="#67854E">**OR**</font> conditions are limited to three per command, with no more than three inclusions per condition. In the example in the above section, the first **OR** condition contains two inclusions **(DOPN>150 DUE=0)**, the second has one inclusion **(TBRD>3)**, and the third has two inclusions **(MILK\<40 DIM>100)**.
- <font color="#67854E">**OR**</font> statements cannot be embedded within other **OR** statements. For instance, this is not allowed:
  **((DCC\<215 (FCM\<45) (SCC>1000))**
- <font color="#67854E">**OR**</font> conditions can be used with the ENTER command for automatic or batch entries. See [Reports](docId\:hTJSQN0TLfIXVwX2CNMrK) to learn more about batch entries.
:::
::::

::::ExpandableHeading
## Ranges

In addition to the operators already mentioned, you can use the hyphen character (-) to specify ranges for your reports. For example:

- **PEN=**<font color="#EAB308">**1-4**</font> returns all animals in pens 1 through 4.
- MIL&#x4B;**=**<font color="#EAB308">**50-60**</font> returns all milking from 50 to 60 pounds.

Ranges can also be used in reverse order to exclude particular animals from your report:

- **PEN=**<font color="#EAB308">**4-2**</font> returns all animals NOT in pens 2, 3, and 4.
- **MILK=**<font color="#EAB308">**90-70**</font> returns animals milking less than 70 pounds or more than 90 pounds.

:::hint{type="info"}
**NOTE:&#x20;**&#x55;sing a hyphen/range along with a "not equal to" operator (for instance, **FOR** **DCC\<>0-150**) will not work and will produce an error message.
:::
::::

:::ExpandableHeading
## Date Formats

When entering dates for a report, it's recommended that periods (.) be used as separators, as in:

`5.17.21`

Alternatively, the system can also recognize the slash symbol in dates (5/17/21) .
:::

::::ExpandableHeading
## Command Substitutions

Command substitution is a powerful tool for creating partial commands that can be modified at the time of entry, allowing you to change the type and range of data returned by the command. When you use command substitutions, the system will prompt you for one or more values when you enter the command.

To use command substitution, enter a percent sign (%) in the command line followed by a "prompt word." For example, if you enter...

<font color="#6b7280">     </font> <font color="#EAB308">**%**</font>

...the system will prompt for the **BY** method, which we're calling **SORTKEY**.

::Image[]{src="https://api.archbee.com/api/optimize/3h8pSJcGUXEi4HGCCYPTA/C5g25KCuRD5HiYa3lB3t1-20260508-205608.png" size="32" width="864" height="385" darkWidth="864" darkHeight="385" position="flex-start" showCaption="false"}

Then you simply enter the item you want to use in the command. In the case above, MILK is used, so the results are presented by current milk production.

::Image[]{src="https://api.archbee.com/api/optimize/3h8pSJcGUXEi4HGCCYPTA/nUQkygxeGabo5NKI2lTr3_bymilk.png" size="26" width="708" height="439" position="flex-start" darkWidth="708" darkHeight="439" showCaption="false"}

:::hint{type="info"}
**NOTE:&#x20;**&#x52;emember that the word you use after the percent sign (%) is merely the prompt word. In the example above, we used the word SORTKEY because it made sense with the command. The word you choose for your prompt should make it clear to the user what the system is asking for.
:::

:::ExpandableHeading
**Click here for additional command substitution options**

Command substitutions can be combined in numerous ways. Sometimes you might want to limit results to certain pens or to certain SCC levels. You might also want to add additional items to a command. The example below shows how you might prompt to add an additional item to your results and limit the results to a chosen level of SCC:

<font color="#6b7280">   </font> <font color="#EAB308">**%WHAT_ELSE**</font> <font color="#6b7280"> **&gt;**</font>****<font color="#EAB308">**%MIN_SCC**</font>

In this case, the system will first ask you for "what else" you want to show in your results (DIM, MILK, RPRO, etc.) and will then ask you for the minimum SCC level to show in the results.

You can also use substitutions to enter command strings to your commands. So if you want to see results for a certain pen, you could answer the above "what else" prompt with the following to limit the results to pen 4: **FOR** **PEN=4**

Consider using command substitutions to create menus that prompt for the variables you use most often. That way, you can cut down on the number of menu commands you need. For instance, you can create menu options using command substitutions such as "Animals open more than X days" or "Animals between DIM x and y" to use these options more flexibly. See [Reports](docId\:hTJSQN0TLfIXVwX2CNMrK) to learn more.
:::
::::

:::ExpandableHeading
## Related Topics

- [Troubleshoot the Command Line](docId\:SSOf7vqpmQN8mhbhnwmHQ)
:::

