GetAgeValue Example for Delphi
var
nRet: Integer;
nCount: Integer;
begin
LEADDicomDS1.EnableMethodErrors:= False;
//move to the root element
LEADDicomDS1.MoveFirstElement (False);
LEADDicomDS1.MoveRootElement ();
//insert a new element for the Age Value
LEADDicomDS1.InsertElement (False, TAG_PATIENT_AGE, VR_AS, False, 0);
//insert an Age value into the element
LEADDicomDS1.AgeValueCount:= 1;
LEADDicomDS1.AgeValues [0].Number:= 21;
LEADDicomDS1.AgeValues [0].Reference:= SmallInt('Y');
//set the age
nRet:= LEADDicomDS1.SetAgeValue(1);
if(nRet <> 0)then
begin
ShowMessage('Error');
Exit;
end;
LEADDicomDS1.AgeValueCount:= 0; //free the value
//get the value count
nCount:= LEADDicomDS1.GetValueCount;
ShowMessage('There are ' + IntToStr(nCount) + ' values!');
//get the value
nRet:= LEADDicomDS1.GetAgeValue (0, nCount);
//display the value
Edit1.Text:= 'Number: ' + IntToStr(LEADDicomDS1.AgeValues [0].Number) + 'Ref: ' + Chr(LEADDicomDS1.AgeValues [0].Reference);
LEADDicomDS1.EnableMethodErrors:= True;
ShowMessage('wait');
end;