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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to call View method data in another view method

(0) ShareShare
ReportReport
Posted on by 2,426

Good Morning,

Hope you are fine.

I have a query which has GeneralJournalAccountEntry and GenerealJournalEntry as DataSources

i created view with same and added some fields like ledgerdimension,Accountingdate.

I want Fixed asset number from ledger dimension for that i wrote view method to get fixed asset from ledger dimension and  added the string field and gave this view method which is fine.

Now i want to get some fields which is customized table (Ex - xyzTable) In this i have fixed asset number and category field.

Now when i am writing a new view method to get category from xyz table how can i compare with fixed asset which is a view method added as field

For Example if the field i am comparing is a datasource field then i can write like below

 str sDateTime;
        
 sDateTime = SysComputedColumn::returnField(tableStr(VendorInvoiceView), identifierStr(VendInvoiceJour), fieldStr(VendInvoiceJour, createdDateTime));

But in my case the fixed asset is data method added as field in view how can i use view field to compare(fixedasset) with  xyztable. (fixed asset). like in above code my field is not bounded to any datasource its a view method.

Dear experts please provide some solution on this.

Regards,

Have a  great day.

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    What do you mean with a "view method"? Do you mean a computed column?

    You can use computed column by calling viewName.ComputedColumnName.

  • AX 2012 r3 Profile Picture
    2,426 on at

    Hi Nikolaos,

    Correct its a computed column(which returns FixedAsset)

    Regards

  • AX 2012 r3 Profile Picture
    2,426 on at

    i am using static server method how can i use field of view to compare with another sysdicttable (xyzTable )

  • nmaenpaa Profile Picture
    101,160 Moderator on at

    Having a static method, or method running on the server has no impact on the required syntax.

    Could you try to describe what you are trying to achieve? Unfortunately I don't understand your requirement if I read your initial message. You write about SysDictTable, comparing fields, and creating computed columns. But I can't figure out what is the actual question.

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    A computed column is a piece of T-SQL, so you start by thinking about T-SQL code you want to generate - and whether what you want is feasible at all.

    Note if I was you, I probably wouldn't try to do it in a single view. I would reuse or create one view returning the dimension value and I would use it in another view where I could compare the value with other fields. It's looks much easier.

  • AX 2012 r3 Profile Picture
    2,426 on at

    What i am trying is

    1. I have GeneralJournalEntry and GeneralJournalAccountEntry Tables where i have to populate data in my view

    2.Created Query with 2 tables(GJAE and GJE).

    3.I created view based on query

    4.Now i need only fixed asset from ledger dimension in view

    so for that i created one compyted column which return fixed asset number from ledger dimension

    5.Now i need another table (XYZ Table) record with the help of fixed asset that i have added in step - 4

    6.In View methods we can use  like this if that is datsource field in view

    str                    sDateTime;

    sDateTime = SysComputedColumn::returnField(tableStr(VendorInvoiceView), identifierStr(VendInvoiceJour), fieldStr(VendInvoiceJour, createdDateTime));

    7.Now i want to join returned fixed asset i.e in computed column i have to join with another table (Xyz Table) to get data .

    The problem here is '?' what should i use in ? place because fixed asset is not a datasource field it is computed column

    sDateTime = SysComputedColumn::returnField(tableStr(VendorInvoiceView), identifierStr(?), fieldStr(VendInvoiceJour, ?));

    In short how can i join computed column in TSQL Code i.e in another method of same view

  • AX 2012 r3 Profile Picture
    2,426 on at

    Dear Experts please provide any help

  • AX 2012 r3 Profile Picture
    2,426 on at

    Dear Nikolaos,

    Can you please provide any suggestion on this.

    is this not possible ?

    Regards.

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

    I suggest you check Martin's answer again, it's very useful. Then decide which approach you want to use.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 503 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 434 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans