Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Calculate column & showing their values to another tab field..

Posted on by 115

Accounts receivable/Common/Free text invoices/All free text invoices   > select & open any free text invoice

i have created One button (MovieCinema) in below form.

2248.png

when the MovieCinema form is open 

I just want  Collection Column total , in Below Line Collection Total Field..

for this I have Created Two Table  MovieCinemaLine & MovieCinema Header.

Please suggest How to achieve this, what is code & what is method for this.

  • Suggested answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: Calculate column & showing their values to another tab field..

    Hi Praveen,

    I don't know how you designed your tables, but you need to add a method like below (and adjust it) to the header table and on the form control you need to specify DataSource property as a header data source and DataMethod as the name of the method.

    display Amount totalCollections()
    {
    	RM_MovieCinemaLine RM_MovieCinemaLine;
    	;
        select sum(Collections) from RM_MovieCinemaLine
    	    where RM_MovieCinemaLine.HeaderRecId = this.RecId;
    		
    	return RM_MovieCinemaLine.Collections;
    }

    Looks like you also have an issue with relations, you can't do relations like Header.RecId = Line.RecId, because RecId is generated by the system each time when record inserted for each table separately and values will be different. You may need to add RefRecId field to the line and fill it with Header.RecId value when you save the record and use it in the relation instead of Line.RecId

  • PK mishra Profile Picture
    PK mishra 115 on at
    RE: Calculate column & showing their values to another tab field..

    in option 1 st what is the exact code of display method for this.  

  • Verified answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: Calculate column & showing their values to another tab field..

    Hi Praveen,

    You have a couple of options here:

    1. Create a display method on the header table to sum up values from lines docs.microsoft.com/.../using-the-display-method-modifier

    2. Create a real field on the header table and update it by the sum of lines when a record is inserted\updated\deleted on the line level.

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans