Call external function in script
I made a function to convert a number into string.
The function that I wrote is:
<span style='color:blue'>function getsize(x : double): string;
begin
if x > 1048576 then
result := FloatToStrF(x/1048576,ffNumber,15,2) + ' MB'
else
result := FloatToStrF(x/1024,ffNumber,15,1) + ' KB';
end;</span>
The result is like this:
<span style='color:blue'>24,50 MB</span> ...or...
<span style='color:blue'>756,3 KB</span>
I want to call this function and place it in script box so I can convert value from database and present it as string. How can I do it?
The function that I wrote is:
<span style='color:blue'>function getsize(x : double): string;
begin
if x > 1048576 then
result := FloatToStrF(x/1048576,ffNumber,15,2) + ' MB'
else
result := FloatToStrF(x/1024,ffNumber,15,1) + ' KB';
end;</span>
The result is like this:
<span style='color:blue'>24,50 MB</span> ...or...
<span style='color:blue'>756,3 KB</span>
I want to call this function and place it in script box so I can convert value from database and present it as string. How can I do it?
Comments
<span style='color:blue'>procedure TForm6.frReport1GetValue(const ParName: String;
var ParValue: Variant);
begin
if ParName = 'rx_text' then
begin
ParValue := getsize(frVariables);
end;
end if</span>
...where <span style='color:blue'>rx_text</span> is placed in memo box and <span style='color:blue'>rx_num</span> placed in script box (<span style='color:blue'>rx_num := [ABSQuery1."rx"]</span>).