procedure Variable5OnCalc(var Value: Variant);
begin
If GetSQLIntegerData('select count(*) as dd from doctor where code="'+ DBPipeline['doctor']+'" '+
'and position_id="1"')=1 then
Value :='('+GetSQLStringData('select name from doctor where code="'+ DBPipeline['doctor']+'" ')+')'
else
Value :='('+GetSQLStringData('select name from doctor where code="'+ DBPipeline['command_doctor']+'" ')+')';
end;