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 1:21PM
    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 1:21PM
    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 1:21PM
    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

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.