✏️ Explanatory Question
In Dynamics 365 Finance & Operations (D365 F&O), understanding the difference between fieldNum and fieldStr is key when working with queries in X++, especially when building dynamic ranges.
| Feature | fieldNum() |
fieldStr() |
|---|---|---|
| Returns | Field ID (integer) | Field name (string) |
| Used For | Used where the system expects a field ID | Used where the system expects a string name of the field |
| Common Use | QueryBuildDataSource.addRange() |
Expressions in queryValue() or complex ranges like FIELD(...) |
| Example | fieldNum(CustTable, AccountNum) → 5 |
fieldStr(CustTable, AccountNum) → "AccountNum" |