I have two tables looking like this:
Table A: Medication Log
Field 1: Date (Date)
Field 2: Patient number (Integer)
Field 3: A (Integer)
Field 4: B (Integer)
Filed 5: C (Integer)
Table B: Treatments
Field 1: Id number (Integer)
Field 2: A (Integer)
Field 3: B (Integer)
Field 4: C (Integer)
Field 5: Resting days (Integer)
In my Medication table I have several records for each patient on each date. The combination of A, B and C gives the code for the treatment as defined in Table B.
Now my problem is that I would like to make a report that for each patient on a specific treatment date (given by me) tells me the treatment he/she has received with the largest number of Resting Days.
Please advice.
Thanks.
0
Comments
You would start with data from your Log table and find matching data in the Treatment table. You would set a filter to find that matching data. (SETRANGE, SETFILTER)
Since you will likely have more than one entry that matches you want that data sorted a certain way so that the largest rest is first (SETCURRENTKEY)
If you don't know what those things mean then you need to read up with the NAV development material.
Developing NAV, the NAV way is totally different from whatever you did before.
I am doing a level 100 introduction session at Decisions in two weeks. Here I explain the basic differences between traditional design and NAV design and why it is so important to develop the NAV way
http://decisions.msdynamicsworld.com/se ... ion-design
Thanks.
Andwian
IF Restingdays > 0D THEN BEGIN
Treatments.RESET;
Treatments.SETCURRENTKEY(Restingdays,A,B,C);
Treatments.SETFILTER(Restingdays,'>0');
IF Treatments.FIND('-') THEN REPEAT
MedicationLog.RESET;
MedicationLog.SETRANGE(Treatments.Nummer, Nummer);
MedicationLog.SETRANGE(Medicationdate,Date entered by user);
MedicationLog.SETRANGE(A,Treatments.A);
MedicationLog.SETRANGE(B,Treatments.B);
MedicationLog.SETRANGE(C,Treatments.C);
IF MedicationLog.FINDLAST THEN
Treatment := Treatments +
FORMAT(Treatments.A) +
FORMAT(Treatments.B) +
FORMAT(Treatments.C) +;
UNTIL Treatments.NEXT = 0;
END;
It does give me the the treatments given on the specified date entered by the user, but it gives me all of the treatments given on that date. I only need the treament with the most restingdays.
I know it must be something with the sorting but I don't know how to fix it.
Thanks.
Then, we could run into your solution further. Since I could not understand well what is your need.
Andwian
Andwian
Each combination is a treatment.
Thank you for your patience.
Andwian
I assume that this is not using report to generate.
Unfortunately I don't have NAV on-hand. Hence, let see if the imaginary-compiler is still working well
Andwian
Thank you very much.