home *** CD-ROM | disk | FTP | other *** search
- program DB_Xpl12;
- uses
- CRT,
- DOS,
- GS_KeyI,
- GS_dBFld,
- GS_dBase;
-
- var
- HlthData,
- Health : GS_dBFld_Objt;
- DumyStr : string;
-
- procedure DisplayRecord;
- begin
- HlthData.FieldDisplay('F_CODE','Food Code: ',1,1);
- HlthData.FieldDisplay('L_NAME','Last Name: ',1,2);
- HlthData.FieldDisplay('M_DATE','Date of Meal: ',1,3);
- Health.FieldDisplay('FOOD','Name of Food: ',1,5);
- Health.FieldDisplay('FOOD_CODE','',70,5);
- Health.FieldDisplay('QUANTITY','Quantity: ',1,6);
- Health.FieldDisplay('UNITTYPE','Type of Unit: ',1,7);
- Health.FieldDisplay('CALS','Calories: ',1,8);
- Health.FieldDisplay('TOT_FAT_G','Total Fat: ',1,9);
- Health.FieldDisplay('SAT_FAT_G','Saturated Fat: ',1,10);
- gotoxy(1,11);
- if Health.NumberGet('TOT_FAT_G') > 0.000 then
- write('Percent of Saturated Fat to Total Fat is : ',
- (Health.NumberGet('SAT_FAT_G')*100)/Health.NumberGet('TOT_FAT_G'):5:1)
- else write('':79);
- Health.FieldDisplay('CHOLES_MG','Cholesterol per Mg: ',1,12);
- Health.FieldDisplay('COMMENTS','COMMENTS: ',1,13);
- end;
-
- begin
- ClrScr;
- GotoXY(1,25);
- write('Press ESC to stop, any other key to continue');
- HlthData.Init('HLTHDATA');
- HlthData.Open;
- Health.Init('HEALTH');
- Health.Open;
-
- { This command may be used to reindex the file}
- { Health.IndexTo('FOODCODE','FOOD_CODE');}
- Health.Index('FOODCODE');
- HlthData.GetRec(Top_Record);
- while (not Health.File_EOF) and (not GS_KeyI_Esc) do
- begin
- if Health.Find(HlthData.StringGet('F_CODE')) then
- begin
- DisplayRecord;
- WaitForKey;
- if GS_KeyI_Chr = Kbd_Esc then GS_KeyI_Esc := true;
- end;
- HlthData.GetRec(Next_Record);
- end;
- Health.Close;
- HlthData.Close;
- end.