ตอนแรกใช้ If...then...elseprocedure DBText11OnGetText(var Text: String);
begin
If DBPipeline['result_type'] = 0 then
If DBPipeline['sex'] = 1 then
If DBPipeline['lab_order_result'] < DBPipeline['range_check_min'] then
Text := 'L'
else
If DBPipeline['lab_order_result'] > DBPipeline['range_check_max'] then
Text := 'H'
else
Text := ''
else
If DBPipeline['lab_order_result'] < DBPipeline['range_check_min_female'] then
Text := 'L'
else
If DBPipeline['lab_order_result'] > DBPipeline['range_check_max_female'] then
Text := 'H'
else
Text := '';
end;
ไม่สามารถแสดงผลได้ถูกต้องหาก sex <> 1เลยเปลี่ยนมาใช้แบบนี้procedure DBText11OnGetText(var Text: String);
begin
If DBPipeline['result_type'] = 0 then
begin
case DBPipeline['sex'] of
1: If DBPipeline['lab_order_result'] < DBPipeline['range_check_min'] then
Text := 'L'
else
If DBPipeline['lab_order_result'] > DBPipeline['range_check_max'] then
Text := 'H'
else
Text := '';
2: If DBPipeline['lab_order_result'] < DBPipeline['range_check_min_female'] then
Text := 'L'
else
If DBPipeline['lab_order_result'] > DBPipeline['range_check_max_female'] then
Text := 'H'
else
Text := '';
end;
end;
end;
เข้าใจว่าคงต้องใส่ begin...end; ครอบ if บางช่วง แต่ยังไม่รู้ว่าจะใส่ตรงไหนดี ใช้ได้บ่อยแค่ไหน
เดี๋ยวคืนนี้จะทดลองหาคำตอบก่อนครับ