Skip to Content
author's profile photo Former Member
Former Member

cumulative balance - which table?

Hi there, I am writing a fairly simple query from JDT1, but i can't find the cumulative balance column in either ODJT or JDT1. is it in a different table or is there a formula i should write?

thanks, my example query is below:

SELECT T1.[TransId], T1.[Account], T1.[CreatedBy], T1.[ContraAct], T1.[LineMemo], T1.[Credit], T1.[Debit], T1.[DebCred], FROM [dbo].[JDT1] T1 INNER JOIN OJDT T2 ON T1.TransId = T2.TransId WHERE T1.[Account] = '[%0]' and T1.[RefDate] between '[%1]' and '[%2]'

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Feb 10, 2010 at 04:37 PM

    Hello Groovy,

    You can use the word SUM to sum the different values.

    E.g. this sums the values of both credit and debit side and it was used in the query generator:

    SELECT sum(T0.[Debit]) + sum(T0.[Credit]) FROM JDT1 T0 INNER JOIN OJDT T1 ON T0.TransId = T1.TransId WHERE T1.[TransId] = '95' group by t1.transid

    or if you want the total of the column you can use:

    select SUM (debit) from jdt1 where transid = 'XXX'

    and it will sum the total of debit for that transid.

    Please, let me know if the information helped you. If not, can you please give us more information about what you need?

    Thank you.

    Marcella Rivi

    SAP Business One Forums Team

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 10, 2010 at 04:25 PM

    Hi,

    There is no such field or table for you to hold those cumulative balances. They are calculated on the fly in run time application.

    One option for you would be: export your query result to Excel and get those cumulative balances by a new column with a simple formula.

    Thanks,

    Gordon

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.