value return empty

edited January 2010 in FastReport 4.0
i have this procedure and when is picture4.picture.loadfromfile(<Fot1>+vf1); = ''
is dosent load more and gives a error how can i fix This?


Thanks

procedure Picture4OnBeforePrint(Sender: TfrxComponent);
var
vF1:String;
begin
vF1:=<Termografia_sub."Foto2"> ;
picture4.picture.loadfromfile(<Fot1>+vf1);
end;

Comments

  • Anu de DeusAnu de Deus Hampshire, UK
    edited 4:05PM
    I suppose <fot1> is a string too, right?
    I don't have the solution, but I can help you to debug it, try isolating the string with the filename and check it first:
    try this:
    var FullPath: string;
    procedure Picture4OnBeforePrint(Sender: TfrxComponent);
    var        
    vF1:String;    
    begin
     vF1:=<Termografia_sub."Foto2">;  
     FullPath := <Fot1>+vf1;  << if you get a script error here, you know that something is wrong with <Fot1>
     showmessage(FullPath);
     if FileExists(FullPath) then     
       picture4.picture.loadfromfile(FullPath)
     else
      showmessage("Cant find file: " +FullPath);
    end;
    


  • edited January 2010
    Yes it??s a string but if the field dosent have nothing it get s a Error ?? hou can i bypass that?

    vF1:=<Termografia_sub."Foto2"> ( C:\car.jpeg) = OK
    vF1:=<Termografia_sub."Foto2"> ( " " ) = error ? and i have to insert a Picture..

    Im i clear???

    Thank??s
  • gordkgordk St.Catherines On. Canada.
    edited 4:05PM
    just as Anu showed you
    run a filexists test on the string if file does not exist do something else.
    BTW you must have created a filexists function to be able to use it.
  • Anu de DeusAnu de Deus Hampshire, UK
    edited 4:05PM
    mflopes wrote: »
    vF1:=<Termografia_sub."Foto2"> ( " " ) = error ? and i have to insert a Picture..

    if Length(trim(vF1)) <1 then
    vF1 := 'C:\YourDefaultPicture.bmp';


Leave a Comment