Dynamic picture based on a condition in report

hvdstroethvdstroet Member Posts: 3
edited 2006-03-14 in Navision Attain
Hello,

I am trying to design a report which shows a picture based on an if statement.

I understand that it is possible to do this with pictures which are stored into a table as BLOB.

Can anyone me explain step by step how this works?

First I'd like to know how pictures are imported to a table and second, what code do I need to display one of the imported pictures?

I read already some threads on the forum, but especially the import of the pictures into a table is not clear to me.

Thanks in advance,

Henk

Comments

  • ara3nara3n Member Posts: 9,256
    Take a look at company information form. Click on Picture Menu Button and look at the code. This will show you how to import a picture into a blob.
    BTW you can view only bitmaps in navision, but you can import any file.



    To see how it is printed on a report. Find a report that prints the bitmap. Take a look at the code. It's pretty simple.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • krikikriki Member, Moderator Posts: 9,112
    To import:
    recMyRecord."BLOB-field".IMPORT(...); (see Form 346 menubutton picture=>Import).

    To show:
    Put a picturebox on the report and give it a sourceexpression that is a BLOB-field of a record (e.g. "BLOB Field1".
    And put this code in the OnAfterGetRecord.
    CASE intBlobToShow
      1: recMyRecord.CALCFIELDS("BLOB Field1");
      2: BEGIN
        recMyRecord.CALCFIELDS("BLOB Field2");
        recMyRecord."BLOB Field1" := recMyRecord."BLOB Field2";
      END;
      3: BEGIN
        recMyRecord.CALCFIELDS("BLOB Field3");
        recMyRecord."BLOB Field1" := "BLOB Field3";
      END;
    END;
    
    BTW : DON'T SAVE the record, because this would overwrite "BLOB Field1" with field 2 or 3.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • hvdstroethvdstroet Member Posts: 3
    Thanks, that works!
Sign In or Register to comment.