Help - Search - Members - Calendar
Full Version: How to access external objects ?
Fast Reports forum > Fast Reports Products > FastReport 3.0
robertonicchi
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
AlexTZ
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.
robertonicchi
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 smile.gif
robertonicchi
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
AlexTZ
You should add nexus db components by fsGlobalUnit.AddClass method.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.