Scripting

edited 2:33PM in FastReport 4.0
Hi, I'm new to Fast Report and scripting.

I have created an easy report with a masterdata, on that band I have connected to a datasource
and selected the fields from the datasource I would like to print.
No problems so far and the report shows with correct values.

But I have a checkox component on that band that is connected to a datafield of boolean type.
The problem is that I would like to reverse the values, if the value in the datasource is True then the
checkbox would not be checked, and if the value is false the checkbox will be checked.... it's easy in
delphi code but how to solve it in Fast Report code section?

I have selected the checkbox and set the OnbeforePrint event, but in the code I don't know how
to make the above works?

Another question:

For example how can I in the code get the datasource of my project and access any field from it as you
you do in Delphi code? For ex query1.FieldByName('field1').AsString for example.
I have an frxDBDataSet1 component attached to the MasterData band and I would like to get any field from
it by code.

Is there also any good documentation about the scripting possibilites in Fast Report 4 VCL pro edition?

Thanks in advance!

Marco.

Comments

  • gpigpi
    edited 2:33PM
    wrote:
    I have selected the checkbox and set the OnbeforePrint event, but in the code I don't know how
    to make the above works?
    Try to set checkbox Expression property
    wrote:
    For ex query1.FieldByName('field1').AsString for example.
    Use
    var DS: TfrxDataSet;
    begin
        DS:=Report.GetDataset('Items');
        DS.First;
        while not DS.Eof do      
          begin          
            ShowMessage(DS.Value('Part Name'));
            DS.NEXT;
          end;        
    end.
    
  • edited 2:33PM
    Thanks! [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> However I did solve it by putting an checkbox on the report and then on MasterDataBeforePrint, check if the dataset's field are true or false: procedure MasterData1OnBeforePrint(Sender: TfrxComponent); begin if <frxDBDataset1."InternalField"> = True then CheckBox1.Checked := False; if <frxDBDataset1."InternalField"> = False then CheckBox1.Checked := True; end;[/img]

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.