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, ...
Answered

I want to put a 'while select statement' in the string computed filed(view's field)

(0) ShareShare
ReportReport
Posted on by

The while statement I'm about to write is as follows.

===================================================================================================================================


while select SumOth
where SumOth.ItemId == this.ItemId
join DimOth
where DimOth.inventDimId == SumOth.InventDimId
&& DimOth.InventSiteId == this.InventSiteId
join LocaOth
where LocaOth.InventLocationId == DimOth.InventLocationId
&& LocaOth.TYM_PartsSalesBranchOffice == NoYes::Yes
join CusOth
Where LocaOth.TYM_BranchOffice != CusOth.SegmentId
&& CusOth.AccountNum == this.CustAccount

{

ResultSumOth += SumOth.AvailPhysical;
}

this.OtherStock = ResultSumOth;

===================================================================================================================================

I want to add a value by adding a Computed filed

'while select statement' and

put it in a 'string computed filed'.

I expected the use of 'SysComputedColumn' in the 'while select statement' text to come out as intended, but it didn't.

If you know how to do it or have similar experiences, please leave a comment. Thank you for reading it.

I am currently using dynamic365(Finance&operations) as the visual studio 2017 version .

I have the same question (0)
  • Nya Profile Picture
    29,064 on at

    Hi,

    I'll move your issue to the F&O forum for more help.

    Best Regards,

    Nya

  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    Hi JS Lee,

    why did you decide that you need a while select statement? Wouldn't it be much more efficient to just select sum(AvailPhysical) from SumOth?

    Are there some details that you didn't share, or am I missing something?

    If you don't need a while select statement, then you don't need to construct such statement in the computed column, and we don't need to find answer to your question. Correct?

  • Verified answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    Your requirement is impossible. The purpose of a computed column is generating T-SQL code and T-SQL doesn't have anything like 'while select'. Fortunately your code doesn't need any while select at all. You can use 'select sum(AvailPhysical) from ...', which can be done in both X++ and SQL.

    But I think that a computed column is a wrong solutuin for your problem. I suggest you forget that for a moment and focus on your other thread: i Want to put 'not equal' condition on the relation.

  • Community Member Profile Picture
    on at

    Thank you for your answers. I will try again using sum function. Have a nice day

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 663

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 337 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans