Call external function in script

edited 1:55AM in FreeReport
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?

Comments

  • edited 1:55AM
    Ok, I found the solution ;)

    <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>).

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.