grouping/totals

DrexlDrexl Member Posts: 16
edited 2004-04-14 in Navision Attain
Hi,

I'm new at this and I have a question about making a report. I have the following problem. The report has an item no. a code and a number. With every line goes an value.

line 1: no. number value

line 2: Code value

I want it grouped like the two lines above. The value in the first line is the total for the unique occurance of code, no., number. The value in the second line is the total for the code. There's another total for all the totals of the codes combined but I managed to get that in the report. The main problems are getting the two other totals and getting only unique lines (in the line 1 part of the report). Now I get the same line 1 repeated.

I hope the problem is clear so you can give me advice on how to solve it. Thanks!

Comments

  • DrexlDrexl Member Posts: 16
    No one has any idea?

    Maybe I can make it a little clearer cause I think I forgot something when I explained it the first time.

    There's multiple instances of line one which add up to the total in line two. Line one is the unique combination of the three keys and a value which is the total for the unique combination.

    Is it in anyway possible to make something like this? I have no clue.
  • StephenGStephenG Member Posts: 99
    Hi!

    Are you using one Table?

    If so then you need to set the Current key to an appropiate key which contains the fields you want to group by.
    You should also use dataitem property GroupTotalFields and fill it with the fields you want your records to be grouped by. Then you can control which groupfooter/header you need to print with code in the OnPreSection of the GroupFooter/Header Sections.
    CurrReport.SHOWOUTPUT := 
      CurrReport.TOTALSCAUSEDBY = "Record".FIELDNO(Code); 
    

    Hope this will help.
    Answer the question and wait for the answer.
  • DrexlDrexl Member Posts: 16
    I don't think that's exactly what I meant. I'll try to explain some more:

    The part I have the problem with is based on one table.

    This is some sample data from the table


    Code.......No........Number..............Value

    1520.......1.......231.....................25
    1520.......1.......231.....................13
    1520.......3.......231.....................01
    7250.......1.......1732...................24
    7250.......1.......1732...................14
    7250.......1.......1778...................09
    7250.......1.......1946...................09
    7250.......1.......313340................25
    7250.......1.......313340................25
    7250.......1.......313340................09
    7250.......1.......313340................25
    7250.......1.......313340................25
    7250.......2.......1778...................20
    7250.......2.......313340................25
    7250.......2.......313340................25
    7250.......2.......313340................25
    7250.......3.......1778....................19
    7253.......1.......1946....................01
    7254.......1.......1946....................05
    7254.......2.......1778....................14
    7259.......1.......1778....................01
    7259.......1.......1946....................02
    7259.......1.......313340................01
    7259.......2.......313340................25
    7260.......1.......313340................25


    This data should look like this in the report.

    ..............................................................value1........value2

    ................001........231.............................038
    ................003........231.............................001
    1520..........................................................................039
    ................001........1732...........................038
    ................001........1778...........................009
    ................001........1946...........................009
    ................001........313340........................109
    ................002........1778...........................020
    ................002........313340........................075
    ................003........1778...........................019
    7250..........................................................................279
    ................001........1946...........................001
    7253..........................................................................001
    ................001........1946...........................005
    ................002........1778...........................014
    7254..........................................................................019
    ................001........1778...........................001
    ................001........1946...........................002
    ................001........313340........................001
    ................002........313340........................025
    7259..........................................................................029
    ................001........313340........................025
    7260..........................................................................025


    value1 is the total for a group of unique occurences of code, no, number. value2 is the total per code.

    I hope the problem is now entirely clear and someone can help me.

    EDIT: I separated the values with tabs but in the message on the board it has no tabs. So the data maybe looks a little confusing this way. I have no idea how to add tabs to the post which will actually show in the posted message.

    EDIT 2: I solved the edit one problem by using dots. This way it looks like the result I want from the report.
  • StephenGStephenG Member Posts: 99
    Hi

    Are you using a key that contains the fields you want to total by.
    Code, "No." and Number.

    Have you set the dataitem property GroupTotalFields with Code and Number.

    Set the dataitem property TotalFields Value.

    You'll need a group section for Code and also for Number
    then on the appropriate Groupfooter, in the OnPreSection add the code
    for the Group Footer for Code
    OnPrection() 
    CurrReport.SHOWOUTPUT := 
      CurrReport.TOTALSCAUSEDBY = "Record".FIELDNO(Code); 
    
      Display  "No."   Number   Value
    
    For the Groupfooter for Number
    OnPresection()
    CurrReport.SHOWOUTPUT := 
      CurrReport.TOTALSCAUSEDBY = "Record".FIELDNO(Number); 
    
      Display   Code   Value
    
    

    If it helps have a look at Reports 1208 "Job Budget" and 1209 "Job - Actual to Budget"
    Answer the question and wait for the answer.
  • DrexlDrexl Member Posts: 16
    StephenG wrote:
    Are you using a key that contains the fields you want to total by. Code, "No." and Number.

    Yeah, I have a key with those three values.
    Have you set the dataitem property GroupTotalFields with Code and Number.

    Yeah. I'll try the code you put in your post. I'll let know if it works. Thanks!

    If it helps have a look at Reports 1208 "Job Budget" and 1209 "Job - Actual to Budget"

    I'll check those. Thanks!
  • DrexlDrexl Member Posts: 16
    It is working now. Thanks!!

    EDIT: Could you maybe explain why I only have to set code as the key to group on while it actually needs to group on three values.(code, no. number) but I still get the right answer. I got it working now but I don't entirely understand why it's working now.
  • DrexlDrexl Member Posts: 16
    I got another question on about the same topic. It's about the same key of the problem in this thread. It consists of code, no. number. In the last problem I needed to sort it on those three attributes but in the new case on only the last two (no., number). Is there anyway to do that without creating a new key with only those two instances?
Sign In or Register to comment.