---
title: "Column cannot be used for $orderby"
description: "Column cannot be used for $orderby"
keywords: "Column cannot be used for $orderby SystemModifiedAt BC Error Message"
url: "https://myrapidi.com/wiki/column_cannot_be_used_for_orderby"
locale: "en"
published: "2025-10-22T10:26:44Z"
modified: "2025-10-22T10:29:35Z"
---

This error occurred while reading data from Microsoft Dynamics 365 Business Central (BC) via an ODATA connection. The integration attempted to execute an OData query including an `$orderby=LastDateTimeModified` clause.

`400 Bad Request: The column 'LastDateTimeModified' cannot be used for $orderby because it is not bound directly to a table field.`

In Business Central, each field on the Odata page must be bound directly to a table field to be eligible for sorting or filtering via OData.

The error indicates that the field `LastDateTimeModified`:

- Is not a real table field (it could be a variable, calculated field, or a renamed alias), or
- Is not properly bound to the source table (e.g., it’s assigned through AL code rather than `SourceExpr = Rec.FieldName`).

Due to this, Business Central cannot use it in the `$orderby` clause — OData only supports sorting on _real table-bound fields_ that exist in a table key definition.  
  
**How to Troubleshoot & Fix:**  
  
**A. Identify the OData Page used by the integration :&nbsp;**

- In Business Central, go to **Web Services** (`Search > Web Services`).
- Locate the web service used in Rapidi (check the **Object Type = Page** and **Object ID / Name** ).
- Copy the **Object ID** or **Page Name** — you’ll need it next.&nbsp;

**B. Open the page object in AL&nbsp;**

- Open Visual Studio Code (for AL).
- Search for the Page using its Object ID or Name.
- Open the **layout** section → find the field named `LastDateTimeModified` (or the exact field that is used for `$orderby`).

**C. Check if the field is bound to a table field and the necessary changes:**

- **Correct (bound to table field):**

```
field(LastDateTimeModified; Rec.SystemModifiedAt){    ApplicationArea = All;}
```

- **Incorrect (not bound):**

```
field(LastDateTimeModified; MyVar){    ApplicationArea = All;}
```

&nbsp;&nbsp;  
Or

```
field(LastDateTimeModified; SomeCalculatedValue){    ApplicationArea = All;}
```

If it’s not bound to a real table field (`Rec.<FieldName>`), OData **cannot** use it for `$orderby`.
