converting a value

edited 9:24AM in FastReport 4.0
Hello to all

I need a solution for converting a value e.g. :
Program deliveres 1 meter and Report1 should show 1000 millimeter
Report2 should show 100cm

Problem is that I can't use the program to do the conversion.

If possible please give me an example in C++ script code

(I'm using FastReport 4.0 std in C-Builder 10)

Thanks in advance.

Comments

  • edited 9:24AM
    I don't know C++ but I'm sure the example is so simple and you'll get through it [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Use global variables and put them into memos like [Number_x_100] and [Number_x_1000]. Then use on before print event for these memos.[/img]
    var 
        Number_x_100, Number_x_1000 :real;                                                           
      
    procedure Memo4OnBeforePrint(Sender: TfrxComponent);
    begin
      Number_x_100 := <ADOQuery1."ItemsTotal"> * 100;    
    end;
    
    procedure Memo5OnBeforePrint(Sender: TfrxComponent);
    begin
      Number_x_1000 := <ADOQuery1."ItemsTotal"> * 1000;    
    end;
    
    begin
    
    end.
    

    Where my query was from FR compiled demo:

    select custno, itemstotal from orders where custno <= 1300 order by custno

    And final result is below.

    Mick
  • edited 9:24AM
    Mick.pl wrote: »
    I don't know C++ but I'm sure the example is so simple and you'll get through it >

    Yes it is. [img]style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> Here's the C++ code:[/img]
    void Memo01OnBeforePrint(TfrxComponent Sender)
    {
        SET("MyValue", <frxUserDataSet1."Value"> + 1);                   
    }
    

    This adds 1 to the value from the dataset.

    Thanks for help

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.