copy of a variable's value

Hi

I've created a variable's value "var1" ongetvalue evenement but when i want to do a copy([var1],1,3) in order to have the first three letter of my variable, it posts me "[va".
WHY ?

Thanks

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 11:54AM
    Look at what you passed in in the ongetvalue event.
    you probably included a [ within the string.
    ;)
  • edited 11:54AM
    No, the value that i obtain is ok.

    This is my code :
    procedure OnGetValue :
    begin
       if AnsiComparetext(VarName, 'var1') = 0 then
         Value := 'coucou';
    end;
    

    In my report, the variable's value is in a TFrxmemo.
    But when i want to do a copy(Memo3.text,1,6), it shows me "[var1]" instead of "coucou".

    I've tryed "copy([var1],1,6)" but an error message appears "Undeclared identifier <cell1>". I've also tested without [] but it's similar.
  • gordkgordk St.Catherines On. Canada.
    edited 11:54AM
    ok what you are doing is trying to copy the memos.text property which is [var1], u
    you want the value of the variableand you must watch 2 things,
    since you are retrieving the value of the var in the ongetvalue event you can't process it until after it retrieves a value. so write your expression in the memo this way [Copy([var1],1,3)]
    ;)
  • edited 11:54AM
    I already tested that but when my report appears, an error message appears too !!
    "Undeclared identifier var1". ;)

    My variable is into a Memo in a MasterData and the other Memo where i want to do a copy of my variable is in a GroupFooter, is it important ?



  • gordkgordk St.Catherines On. Canada.
    edited 11:54AM
    this assume you created var in report's datadictionary named var1 and did not set any expression value to it.
    your onget value code is bad

    should be
    if AnsiComparetext(parName, 'var1') = 0 then
    parValue := 'coucou';
    ;)
  • edited 11:54AM
    not with the fastReport version 3.05 !

    I've tested on Windows NT4 and an error appears but with Windows XP, I've not got error. Why ?

  • gordkgordk St.Catherines On. Canada.
    edited 11:54AM
    if you are using fr3 please post questions for fr3 in fr3 forum
    the answer i gave you was for fr2.53.
    in version 3
    you must use the get method with the variable
    [copy(get('var1'),1,3)]
    ;)

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.