How to access external objects ?

edited 4:54AM in FastReport 3.0
I read in FR3 features:

Access to any object inside your application (in case you've allowed this). Standard libraries to access to base classes, controls and forms. Easily expandable library architecture.

I suppose that this means that inside a Fr3 script i can refere to objects and variables defined out of FR3


but how i can do this ?
If i try to refere to an external object in my form the script stop with an error: undeclared identifier

thank you

Roberto Nicchi
Italy

Comments

  • edited 4:54AM
    The key phrase is "in case you've allowed this".
    You can access to any object in your project, but you should add it (using FastScript interface) beforehand. You may add an object to the TfrxReport.Script or fsGlobalUnit. See FS documentation for details.
  • edited 4:54AM
    GREAT !!!

    i see that if i do:

    frxreport1.script.AddForm(self);

    before the report is created i can refere to all the components in the form at runtime



    I don't have problems with standard components like the form, a Tbutton or Tlabel
    but when i try to use a third party component (NexusDb) i have an error.

    what i do is:

    frxreport1.script.AddForm(self);
    frxreport1.script.addclass(TnxTable,'TnxTable');
    frxreport1.script.addclass(TnxDatabase,'TnxDatabase');
    frxreport1.ShowReport(true);


    in the FR script i do:

    form1.nxtable1.tablename:='mytable';
    form1.nxtable1.database:=form1.nxdatabase1;
    form1.nxtable1.open;

    when the script is executed at runtime i have the error:

    Script error at 4.45: 'Class TnxDatabase', 'Class TnxDatabase'

    Anyway i'll check the FastScript manual/demo that i see is available for download

    thank you !!!!


    Roberto

    P.S. I like this new toy ;)
  • edited 4:54AM
    it seems that in the script only the line

    form1.nxtable1.database:=form1.nxdatabase1

    doesn't works

    other methods/property can be used

    ex:

    nxtable1.tablename:='articoli';
    // nxtable1.database:=nxdatabase1;
    nxtable1.open;

    jflabel1.value:=nxtable1.fieldbyname(description).asstring;

    where jflabel1 is a TjfLabel from JfCOntrols components suite

    Roberto
  • edited 4:54AM
    You should add nexus db components by fsGlobalUnit.AddClass method.

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.