How to Compare two tables to create an Excel report

redhotmustang
Member Posts: 91
Hi there,
I'm programming an excel report that needs to compare values from two tables in order to create an Excel sheet with the students' classifications.
Excel sheet structure
(Subject) | A | B | C (Type of Classification)
Math | X | |
Sciences | | X |
First, I went to the type of Classification for that Subject.
The result is something like "A", "B", "C". Let's say it founds 3 records.
I need that the first rEval record is compared with varClass[1], varClass[2], varClass[3] (and so on, as long as this array as values), I need that the second rEval record is compared again with that array (varClass[1], varClass[2], varClass[3]...).
I mean as long as there are records for the rEval, all of them need to be compared with ALL the varClasses values, to see if they match.
I need a cycle that increases "i" until "i" ends keeping rEval in the same record. When "i" ends, rEval moves to the next record, and starts comparing itself again with "i" which is now equal to 1, increasing itself until it ends. And so on.
Thanks in advance!
I'm programming an excel report that needs to compare values from two tables in order to create an Excel sheet with the students' classifications.
Excel sheet structure
(Subject) | A | B | C (Type of Classification)
Math | X | |
Sciences | | X |
First, I went to the type of Classification for that Subject.
The result is something like "A", "B", "C". Let's say it founds 3 records.
clear(i); Clear(varClass); rClassTypes.reset; rClassTypes.SETRANGE("Classification Type","Classification Type"); IF rClassTypes.FIND('-') THEN BEGIN REPEAT i := i + 1; varClass[i] := rClass."Class. Code"; //Something like 'A','B','c', and so on. UNTIL rClassTypes.next = 0; END; rEval.RESET; rEval.SETRANGE(Student,Student); rEval.SETRANGE(Subject,Subject); //And more setranges (that don't matter for this topic) IF rEval.FIND('-') THEN BEGIN REPEAT IF rEval."Subject Evaluation" = varClass[i] THEN BEGIN message('match'); //xlActPage.Range(Column + FORMAT(Line)).Value := 'X'; END; UNTIL rEval.next = 0;
I need that the first rEval record is compared with varClass[1], varClass[2], varClass[3] (and so on, as long as this array as values), I need that the second rEval record is compared again with that array (varClass[1], varClass[2], varClass[3]...).
I mean as long as there are records for the rEval, all of them need to be compared with ALL the varClasses values, to see if they match.
I need a cycle that increases "i" until "i" ends keeping rEval in the same record. When "i" ends, rEval moves to the next record, and starts comparing itself again with "i" which is now equal to 1, increasing itself until it ends. And so on.
Thanks in advance!
Redcodestudio: Web Development, FLASH & Webdesign (and a little NAV, in the future)
0
Answers
-
Hi
You could do the followingIF rEval.FIND('-') THEN BEGIN REPEAT FOR x := 1 TO ARRAYLEN(VarClass) DO IF rEval."Subject Evaluation" = varClass[x] THEN BEGIN message('match'); //xlActPage.Range(Column + FORMAT(Line)).Value := 'X'; END; UNTIL rEval.next = 0;
where x is type Integer
Albert0 -
Thanks Albert. It was something like that I was looking for.
Actually, I had to change your code a little bit.IF rEval.FIND('-') THEN BEGIN REPEAT FOR i := 1 TO x DO begin IF rEval."Subject Evaluation" = varClass[i] THEN BEGIN message('match'); //xlActPage.Range(Column + FORMAT(Line)).Value := 'X'; END; END;
Where, x is an integer and is equal to rClassTypes.count.
Using arraylen(varClass) would return the total number of dimensions for that array, and not only the number of dimensions being used, which was I wanted.
Thank You.Redcodestudio: Web Development, FLASH & Webdesign (and a little NAV, in the future)0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions