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 :
Microsoft Dynamics AX (Archived)

Journal Voucher Field should appear in Voucher Transaction List form.

(0) ShareShare
ReportReport
Posted on by 85

AX-Query-Voucher-Trans.JPG

Dear All,
I have a field "Ref Project No." in Journal Voucher grid(Form: LedgerJournalTrans).
I want to this field to be shown in the Voucher Transactions List (Form: LedgerTransVoucher), based on the Journal Number.

So for this, I need to add new DS for table LedgerJournalTrans to get "Ref Project No." from it?
But this gave me error: The name ledgerJournalTrans is already used in an outer scope.

The grid in LedgerTransVoucher is using the GeneralJournalEntry table.
The field which I want to show in this voucher trans. is in LedgerJournalTrans table. How do I link the tables?

Or should I write a query to get the value from LedgerJournalTrans table and fill the field in LedgerTransVoucher in init() ? If this should be done, how I can proceed for it?
What should be done in this scenario? Thank you in advance.!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    jasman Profile Picture
    1,413 on at

    Or you could just change the name on the data source you add to be something else than LedgerJournalTrans.

    You could also do a display method that finds the right value, and add this to the form.

  • Naveen5551 Profile Picture
    85 on at

    Hello Jacob,

    I tried with different Data source name, I did not get the error thank you.

    But am not getting the relevant data in voucher transactions list.

    I mean the data in voucher trans. list is not respective to Journal Numbers.

    This is because, we are not joining the tables anywhere.

    Because I just created a new StringEdit to the grid and given the datasource name and field from this newly added DS.

    Could you please provide me any help links for creating a Display method?

    Or you could suggest me how to do it ?

    Thank you.

  • jasman Profile Picture
    1,413 on at

    When adding a new Data source you should of course see to it that the correct joining happens.

    You will have to write code to join the correct tables anyway if you make a display method.

    Here are the links:

    msdn.microsoft.com/.../aa595058.aspx

    msdn.microsoft.com/.../aa596691.aspx (caching)

  • 5400 Profile Picture
    7,162 on at

    Please don't add any data source in Ledger voucher UI.

    you want to display one field value on the basis of journal number

    thers are two solution

    There is two solution for same

    1. You can carry the field from ledger journaltrans to GeneralJournalentry table during posting and do manuapulation for control

    second:

    You can write display method with respect voucher and journal number to display the value in voucher transaction UI.

    Ledger journaltrans having voucher field which will get stored \Data Dictionary\Tables\SubledgerVoucherGeneralJournalEntry and it has relation with GeneralJournalEntry

    Please check, if you need any info please feel free to post

  • 5400 Profile Picture
    7,162 on at

    Is it your requirement clear here.

  • Naveen5551 Profile Picture
    85 on at

    Yes, my requirement is clear.

    I want a Grid field from LedgerJournalTransDaily (Table: LedgerJournalTrans) to be shown in LedgerTransVoucher grid (Table: GeneralJournalEntry).

    I think the link is based on Journal number for both these tables.

    Please help me to create the display method for this requirement.

  • 5400 Profile Picture
    7,162 on at

    Please create one display method in table as below

    \Data Dictionary\Tables\GeneralJournalEntry\Methods\refProjectNo

    public display str RefProjectNo()    // you can use proper EDT instead of Str

    {

       LedgerJournalTrans      lt;

       SubledgerVoucherGeneralJournalEntry   jl;

       select lt where lt.RefProjectNo != ''

           join jl where jl.Voucher == lt.Voucher

                   && jl.GeneralJournalEntry == this.RecId;

       if (lt.RecId)

       {

           return lt.RefProjectNo;

       }

       else

       {

           return '';

       }

    }

    Now call this method from LedgerTransVoucheras as below.. you have to add one string type field and assign the value as below

    \Forms\LedgerTransVoucher\Designs\Design\[Tab:Tab]\[TabPage:TabOverview]\[Grid:OverviewGrid]\StringEdit:RefProjectNo

    Please go to this field property and assign the data source  as GeneralJournalEntry and put display method name as "RefProjectNo"

    And check.

    Thanks

    Bhaskar

  • 5400 Profile Picture
    7,162 on at

    did you verify.

  • Naveen5551 Profile Picture
    85 on at

    Hello Bhasker,

    It seems to be working, but unable to get the correct results for the journal numbers.

    I will test further more and confirm you.

    Thank you very much for kind help.

    If possible can you check and reply me for community.dynamics.com/.../421154

  • Naveen5551 Profile Picture
    85 on at

    Dear Bhaskar,

    The display method is not working. Im not getting the results in the Voucher Transactions list.

    And when I tried to execute the sql code in a job, it is giving me error "Operand types are not compatible with the operator." at (== "DIL-000013";)

    LedgerJournalTrans    lt;

    SubledgerVoucherGeneralJournalEntry   jl;

    select lt where lt.RefProjectNo != ''

          join jl where jl.Voucher == lt.Voucher

                  && jl.GeneralJournalEntry == "DIL-000013";

      if (lt.RecId)

      {

          info("A: %1", lt.RefProjectNo);

      }

    jl.GeneralJournalEntry expects int type data, but how to cross check the above sql stmt with journal num?

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans