OData filter not working on custom fields in performance analytics module

We’re trying to filter performance analytics data using OData queries on custom fields we added to track shift efficiency metrics. The standard fields filter correctly, but custom fields return empty results or throw 400 Bad Request errors.

Our custom field is ‘ShiftEfficiencyScore’ (decimal type) added through the Smart Factory configurator. We’re using Smart Factory 2023.1.


GET /odata/PerformanceMetrics?$filter=ShiftEfficiencyScore gt 85.0
Response: 400 {"error": "Invalid filter field"}

The API metadata endpoint shows the custom field exists. Is there special syntax for filtering on custom fields, or do they need to be mapped differently in OData queries?

The CustomProperties prefix worked! However, the query is now extremely slow-taking 30+ seconds for a few thousand records. Standard field filters are fast. Is there an indexing issue with custom fields in OData queries?

For performance analytics specifically, consider using the aggregation endpoints instead of raw OData queries. The /api/analytics/aggregate endpoint supports custom field grouping and filtering with much better performance because it uses pre-aggregated data. You can specify custom fields in the dimensions array and they’ll be properly indexed in the analytics warehouse.

I ran into this last quarter. Custom fields are nested under a CustomProperties complex type in the OData model. Your filter syntax should be: $filter=CustomProperties/ShiftEfficiencyScore gt 85.0. Also make sure the field is marked as ‘Filterable’ in the configurator-there’s a checkbox under advanced properties that enables OData filtering for custom fields.

Check if your Smart Factory version supports custom field indexing. In 2023.1, there’s a database maintenance script that creates indexed views for frequently queried custom fields. Run it from the admin console under Database Tools > Optimize Custom Fields. This creates materialized views with proper indexes for OData queries.

Custom fields are stored in a JSON column (or EAV table depending on your database), which can’t be indexed traditionally. You’ll need to create a computed column that extracts the custom field value, then index that column. Alternatively, use the $select parameter to limit returned fields and reduce payload size. Combine with $top and $skip for pagination to avoid large result sets.

Custom fields in Smart Factory OData endpoints use a different namespace. Try prefixing with ‘Custom_’ or check the $metadata endpoint for the exact property name. It’s usually something like CustomFields/ShiftEfficiencyScore rather than ShiftEfficiencyScore directly.