Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

How to call View method data in another view method

Posted on by 2,420

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.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to call View method data in another view method

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

  • AX 2012 r3 Profile Picture
    AX 2012 r3 2,420 on at
    RE: How to call View method data in another view method

    Dear Nikolaos,

    Can you please provide any suggestion on this.

    is this not possible ?

    Regards.

  • AX 2012 r3 Profile Picture
    AX 2012 r3 2,420 on at
    RE: How to call View method data in another view method

    Dear Experts please provide any help

  • AX 2012 r3 Profile Picture
    AX 2012 r3 2,420 on at
    RE: How to call View method data in another view method

    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

  • Martin Dráb Profile Picture
    Martin Dráb 230,149 Most Valuable Professional on at
    RE: How to call View method data in another view method

    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.

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to call View method data in another view method

    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.

  • AX 2012 r3 Profile Picture
    AX 2012 r3 2,420 on at
    RE: How to call View method data in another view method

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

  • AX 2012 r3 Profile Picture
    AX 2012 r3 2,420 on at
    RE: How to call View method data in another view method

    Hi Nikolaos,

    Correct its a computed column(which returns FixedAsset)

    Regards

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to call View method data in another view method

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

    You can use computed column by calling viewName.ComputedColumnName.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans