fr2.5 to 4 versiyon questions

ibrahim bulutibrahim bulut turkey
edited 9:57PM in FastReport 4.0
hi folks,
i have 2 big applications about 280 units per application.
i have 250 reports per application. i have used fast-report 2,54.
i am planning to upgrade fastreport 4 versiyon and working around fr4 for a few days.

a lot of changes made from fast-report and i have got some problems for upgrading.

problem 1
=======
i use variables. i declare a variable and pass value from delphi to report.
frvariables["name"]:='blablabla';
and i can use the variable within memo component like this [name] + 'something'

i can do this with fr4 but some limitations.
now, every reports has own variables and also global variables (like fr2).
i can not change variable's value within the script.
i can read variable's value from script and transfer the value to a script variable.
but, in this time, i can not use script variable within memo component.

is there a way to use script variable in memo component or can i change report variable's value within the script.
i prefer to change report variable's value within the script.

problem 2
=======
i have some null problems with script variables.
i have declared a variable that type of double and assigned a sum function value to this variable.
if sum function returns null, fastreport give me a variant error message.
is there any way to get the value is null. fr2 has fieldisnull function.
or can i know the value is null. the sum functions value is not a variant. it's a variant array.
so, i wrote a isnull function for this for checking null value.

problem 3
=======
how can i upgrade delphi dfm code with a simply way without dropping old fr components

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 9:57PM
    read the programmers manual on variables and their kinds.

    in script you access categorized variables using the set method or get method.
    datafield value using <dsname."fieldname">
    an expression in a memoview can only have one outer set of [ ]
    typed script variables are accessible just like in delphi code can be used in memos by using [ ]
    in script script vars can be handled as in delphi var1 +var2 .
    add duplicate fr4 components report dataset etc.., to your app write new delphi code for them
    add the conversion unit to your app this allows you to open an fr2 file in fr4 designer where it can be saved in a .fr3 format file DO NOT SAVE AS .FR3 FROM FR2 designer.
    it will not be an easy task. in some cases some reports are easier to redsign.
    BTW fr2 and fr4 can co exisit in the same app.


  • ibrahim bulutibrahim bulut turkey
    edited 9:57PM
    hi gord,
    i have tried your suggestions but not succes.
    i have a variable. i can read it's value from script but i can not change it's value.

    script like this

    Var
    NewName : String
    Count : Integer;

    procedure ReportTitle1.Onbeforeprint(Sender : Tfrxcomponent)
    begin
    Count:=1;
    NewName:=<NN>; // success, no problem

    NewName:='blablabla';
    <NN>:=NewName; // gives error, parser tell me "; expected"
    [NN]:=NewName; // gives error, parser tell me "; expected"

    // where is the problem
    // please write me the correct syntax
    end;


    and i can not use Count variable in memo component.
    i write [Count] in memo component, but i can not see anything.


    gordk wrote: »
    read the programmers manual on variables and their kinds.

    in script you access categorized variables using the set method or get method.
    datafield value using <dsname."fieldname">
    an expression in a memoview can only have one outer set of [ ]
    typed script variables are accessible just like in delphi code can be used in memos by using [ ]
    in script script vars can be handled as in delphi var1 +var2 .
    add duplicate fr4 components report dataset etc.., to your app write new delphi code for them
    add the conversion unit to your app this allows you to open an fr2 file in fr4 designer where it can be saved in a .fr3 format file DO NOT SAVE AS .FR3 FROM FR2 designer.
    it will not be an easy task. in some cases some reports are easier to redsign.
    BTW fr2 and fr4 can co exisit in the same app.
  • gordkgordk St.Catherines On. Canada.
    edited 9:57PM
    what is NN ? a categorized variable
  • ibrahim bulutibrahim bulut turkey
    edited 9:57PM
    yes, it's a categorized variable

    gordk wrote: »
    what is NN ? a categorized variable
  • gordkgordk St.Catherines On. Canada.
    edited 9:57PM
    As i stated previously with cat vars in script you must use set and get methods.
    Set('NN', '''' + newname + ''''); or hardcoded string value
    Set('NN', '''' + 'String' + '''');

    important to remember with cat vars and string values you must end up with the cat vars string value
    having extra delimiters ' or it will be treated as an unknown expression and trigger the external ongetvalue event of the tfrxreport component and if you have not written a handler for that event an error will occur.
    same holds true for passing a string value into a cat var from delphi.

    spend some time reading the programmers manual on variables and the users manual on script.

    Also you will find a number of new events so you may want to move some code from obp event to oap or oad events.

  • ibrahim bulutibrahim bulut turkey
    edited 9:57PM
    i have tried and success.
    i have read programmer manuel and there isn't any any comment about get and set method in it.

    but my script variable problem already exists.
    how can i use a script variable in a memo component
    [scriptvar] or <scriptvar> or another syntax
    so, i need an example

    gordk wrote: »
    As i stated previously with cat vars in script you must use set and get methods.
    Set('NN', '''' + newname + ''''); or hardcoded string value
    Set('NN', '''' + 'String' + '''');

    important to remember with cat vars and string values you must end up with the cat vars string value
    having extra delimiters ' or it will be treated as an unknown expression and trigger the external ongetvalue event of the tfrxreport component and if you have not written a handler for that event an error will occur.
    same holds true for passing a string value into a cat var from delphi.

    spend some time reading the programmers manual on variables and the users manual on script.

    Also you will find a number of new events so you may want to move some code from obp event to oap or oad events.
  • gordkgordk St.Catherines On. Canada.
    edited 9:57PM
    i have read programmer manuel and there isn't any any comment about get and set method in it.
    of course not it is used in script so it's in the users manual!
    tip read the programmers manual as working from delphi and the users manual as working from within the report few exceptions(exporting)
    script var in a memo
    [newname]
    also read the note about conversions pinned to this forum and the fr3 forum they may help you.
  • ibrahim bulutibrahim bulut turkey
    edited 9:57PM
    my string script variable is ok but my integer value is not displaying.
    and it's value not zero.
    >
    gordk wrote: »
    i have read programmer manuel and there isn't any any comment about get and set method in it.
    of course not it is used in script so it's in the users manual!
    tip read the programmers manual as working from delphi and the users manual as working from within the report few exceptions(exporting)
    script var in a memo
    [newname]
    also read the note about conversions pinned to this forum and the fr3 forum they may help you.
  • ibrahim bulutibrahim bulut turkey
    edited 9:57PM
    sorry, i have declared a variable with the same name script variable.
    problem solved.
    my string script variable is ok but my integer value is not displaying.
    and it's value not zero.
    >
    i have read programmer manuel and there isn't any any comment about get and set method in it.
    of course not it is used in script so it's in the users manual!
    tip read the programmers manual as working from delphi and the users manual as working from within the report few exceptions(exporting)
    script var in a memo
    [newname]
    also read the note about conversions pinned to this forum and the fr3 forum they may help you.

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.