Record shown twice in report
bRahms
Member Posts: 44
Hi again,
we managed to put in our report different fields of several tables.
But when we are trying to link the DossierID with the PersoneelslidID, we're getting no error, but something strange:
The first record is shown twice, and then it works "correct", with a delay of 1 record (since the first one is shown twice). The code we are using to find is:
we managed to put in our report different fields of several tables.
But when we are trying to link the DossierID with the PersoneelslidID, we're getting no error, but something strange:
The first record is shown twice, and then it works "correct", with a delay of 1 record (since the first one is shown twice). The code we are using to find is:
recBegeleiderPJ.RESET;
recBegeleiderPJ.SETCURRENTKEY(PersoneelslidID, DossierID);
recBegeleiderPJ.SETFILTER(DossierID, '=%1', DossierID);
recBegeleiderPJ.FIND('-');
IF recBegeleiderPJ.PersoneelslidID <> 0 THEN BEGIN
recbegeleider.RESET;
recbegeleider.SETCURRENTKEY(PersoneelslidID);
recbegeleider.SETRANGE(PersoneelslidID, recBegeleiderPJ.PersoneelslidID);
recbegeleider.FIND('-');
END ELSE BEGIN
EXIT;
END;
0
Comments
-
I prefer "normal" way to create report:
1. Create dataitem recBegeleiderPJ with appropriata Tableview property setting
2. Create dataitem recbegeleider with appropriate Tableview property setting and linked to recBegeleiderPJ dataitem by PersoneelslidID
3. Fill fields in needec sections0 -
thx for your help, but since we are beginners i have to admit i don't know what you mean exactly.. can you be a more specific?0
-
Please, go through some manuals for "how to create basic reports". It is just about creating two nested dataitems in the report, and connecting them through properties. For example see standard report 3 G/L Register for two nested dataitems...0
-
We know how to make basic reports, it's just strange that he does it all correctly (!!), except for the first record.
0 -
We only want to know what we're doing wrong in the code we've given. There has to be something in it that says "Use the same PersoneelslidID for the first to DossierID's.
DossierID 1 -> PersoneelslidID 1
DossierID 2 -> PersoneelslidID 1
DossierID 3 -> PersoneelslidID 2
While it has to be
DossierID 1 -> PersoneelslidID 1
DossierID 2 -> PersoneelslidID 2
DossierID 3 -> PersoneelslidID 30 -
nobody?0
-
If you really want to create report by your way, there are some errors in your code:
recBegeleiderPJ.RESET;
recBegeleiderPJ.SETCURRENTKEY(PersoneelslidID, DossierID); may take a long time to filter, because key is not optimal
recBegeleiderPJ.SETFILTER(DossierID, '=%1', DossierID);
//recBegeleiderPJ.FIND('-');
if recBegeleiderPJ.FIND('-') then ...
IF recBegeleiderPJ.PersoneelslidID <> 0 THEN BEGIN
recbegeleider.RESET;
recbegeleider.SETCURRENTKEY(PersoneelslidID);
recbegeleider.SETRANGE(PersoneelslidID, recBegeleiderPJ.PersoneelslidID);
// recbegeleider.FIND('-');
if recbegeleider.FIND('-') then ...
END ELSE BEGIN
EXIT;
END;
but it is hard to find mistake exactly because I have to see the whole object.0 -
bRahms wrote:We know how to make basic reports, it's just strange that he does it all correctly (!!), except for the first record.

If it is not working, it is not done correctly... 8)
Can you post whole code (including names of triggers where the code is used)?0 -
Name DataType Subtype Length recdossier Record tblDossier recjongere Record tblJongere recbegeleider Record tblPersoneelslid recBegeleiderPJ Record tblDossierPerPersoneelslid
We used tblDossier to buid up the report (the part of it that is used for what we want, we've got several Dataitems)
Want we want is that when there is a particular DossierID chosen in a field below, that the PersoneelslidID is shown that is linked to that DossierID via tblDossierPerPersoonelslid.
We tought we could manage that through the given code in the beginning. He does what we want it to do, he links the DossierID's to the PersooneelslidID, but then he shows the first record twice, so the rest doesn't match the right PersooneelslidID, but the PersooneelslidID-1.0 -
Still I do not know in which trigger you are setting the records. You need to do it on correct trigger because the triggers are called in some order and the values are printed between them, and if you change the value after the section is printed, the values will be shifted.0
-
tblDossier, Header (1) - OnPreSection()
is it that you mean? 8-[0 -
or not?
0 -
You have to have three dataitems:
tblDossier
tblDossierPerPersoneelslid - indented and linked to tblDossier by DossierID
tblPersoneelslid - two times indented and linked to tblDossierPerPersoneelslid by PersoneelslidID
Nothing to code, only insert fields to desired section.0 -
Code on section, not using the dataitems, names all screwed up. No wonder your code doesnt work. On presection it has already found the first record. Take a programming course and read the programmers, and developers guides.0
-
You should write ALL of your data code in the dataitem triggers, and NONE of it in any of the section triggers. The section triggers should only be used to determine whether to print the section, to set fonts, positions etcetera.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 250 Dynamics CRM
- 102 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

