web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

SysComputedColumn rounding

(0) ShareShare
ReportReport
Posted on by 13

Hello,

for the first time I am working with SysComputedColumn and I am having a problem with this requirement. There is a view with SysComputedColumn, that returns some value with some number of decimal places. Iwant to take this value from system:

pastedimage1676909662726v1.png_2D00_864x642.png_2D00_640x480.png_2D00_640x480.png

and round the value, that is returned by the SysComputedColumn to the same number of decimal places as is in the General rounding rule for EUR.

I have created SQL select statement, that returns the value of the General rounding rule (0.01). But I have no idea, how to round the SysComputedColumn returned value. I was thinking about something like:

return strFmt('ROUND(%1, mySelectStatement)',
SysComputedColumn::if(SysComputedColumn::and(projActualCostItemList),
SPLProjTransPostingCube::projReportingActualConsCostHours(),
SPLProjTransPostingCube::projActualConsumptionCostHours()
));

but I do not know, if it is possible to use the round function in SysComputedColumn or round function inside strFmt, because as I know, it creates SELECT statements from SysComputedColumns. I did not find any method for rounding the SysComputedColumn, just this thread:     but it is not what I am looking for, as I need the number of decimals is not a constant, but it should be dynamic based on the value of General rounding rule.

Any idea, please? Sorry if I missed something, but this is first time I am working with SysComputedColumn, never have even heard about that before

I have the same question (0)
  • Martin Dráb Profile Picture
    239,178 Most Valuable Professional on at

    Yes, you can use ROUND in a computed column method. You can use anything that produces correct T-SQL code (for the given context).

  • Sayah Profile Picture
    13 on at

    goshoom 

    Ok thanks. And where is the problem in my case, please? When I use it for testing purposes like

    return strFmt('round(%1, 1)',
                               SysComputedColumn::if(
                               SysComputedColumn::and(projActualCostItemList),
                               SPLProjTransPostingCube::projReportingActualConsCostHours(),
                               SPLProjTransPostingCube::projActualConsumptionCostHours()));

    it means I want to round the value to one decimal place. The value that I have is originaly like xxx.2543 but the result when I want to round that to one decimal place is xxx.6.

    And how can I work with that dynamic field that determines, how many decimal places should be used? Because as I know, when I have a " public static server str method()" on a view, I am not able to use/create normal x methods, or am I? just methods with SysComputedColumns?

  • Martin Dráb Profile Picture
    239,178 Most Valuable Professional on at

    The purpose of the method is generating SQL code. You can use normal X++ methods, but only to generate the string with SQL code. You can't directly fetch data in X++; you need to generate SQL fetching the data.

    Therefore your next step is checking what code you're generating at the moment and comparing it with what you intend to get.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 681

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 446 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 202 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans