--- title: "Apply a custom expression to define a document record range" slug: "apply-a-custom-expression-to-define-a-document-record-range" tags: ["Concept topic"] updated: 2026-03-20T09:38:31Z published: 2026-03-20T17:44:03Z canonical: "docs.staedean.com/apply-a-custom-expression-to-define-a-document-record-range" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.staedean.com/llms.txt > Use this file to discover all available pages before exploring further. # Apply a custom expression to define a document record range You can apply customized expressions as range on a document record. ### Document You can apply the expression as range to the source document if is a D365 F&SCM document. To do so, add a range of type **Custom** to the desired document record. Usually, this is the root record. In the **Range** field, enter the expression.. ### Example You need a range that limits the selection of records to records with a date later than today or no date defined. In this case, use this expression: StrFmt(‘(tableName.todate > %1) || (tableName.todate == %2)’, today(), 0) > [!NOTE] > **Note** > > Do not use this expression: StrFmt(‘(tableName.todate > %1) || (tableName.todate == %2)’, today(), dateNull()) ### Other Examples of other custom expressions that you can apply are: - strFmt('(PurchPool.BisQualifier == \"%1\") || (PurchPool.BisQualifier == \"\")', curext()) - strfmt('%1,\"\"', curext()) - strFmt('> %1', SysQuery::value(DateTimeUtil::utcNow())) - strFmt('((> %1 || \"\"))', SysQuery::value(DateTimeUtil::utcNow())) - strFmt(' %1 | %2',BisCompanyParameters::find(curExt()).recid,BisCompanyParameters::find(curExt()).SourceCompanyid) - SysQuery::range(DateTimeUtil::minValue(),DateTimeUtil::utcNow()) - SysQuery::range(DateTimeUtil::utcNow(), DateTimeUtil::maxValue()) - curExt() - BisCompanyParameters::find(curExt()).LedgerChartOfAccounts - InventDim::inventDimIdBlank() - tableNum(EcoResCategory) - SysQueryRangeutil::LessThanDate(0) - SysQueryRangeUtil::greaterThanDate(0) - SysQueryRangeutil::LessThanDate(-3) - SysQueryRangeUtil::greaterThanDate(-3) - queryValue(dateNull()) - sysQueryRangeUtil::lessThanUtcNow() - SysQueryRangeUtil::greaterThanUtcNow() - SysQuery::value(DateTimeUtil::MinValue()) - BisCompanyParameters::find(curExt()).SourceCompanyid - BisCompanyParameters::find(curExt()).LedgerChartOfAccounts - BisCompanyParameters::find(curExt()).SourceCompanyid - BisCompanyParameters::find(curExt()).LedgerChartOfAccounts ## Related - [Define range](/define-range.md)