How to insert picture from report

selece28selece28 Member Posts: 316
Hi All,
I have a problem
I currently creating a report to print picture selected from file
I use a Request Form and use the Common Dialog Management CU to select the file.
I put the filepath in a global variable (text 1024)
I create a Table that contains only one field with the type of BLOB

My question is how to save the image to the table. I try Insert and Modify
But it shows errors

Thanks in advance
______________

Regards,
Steven

Comments

  • mcapuccimcapucci Member Posts: 18
    what kind of error?
  • selece28selece28 Member Posts: 316
    If I use TempPicture.MODIFY after TempPicture.Picture.IMPORT(filepath);
    It Shows TempPicture Picture ' ' does not exist.

    If I use TempPicture.INSERT after TempPicture.Picture.IMPORT(filepath);
    It Shows TempPicture Picture '*' does not exist.

    How to solve this, i'm lost
    If i comment the Insert / Modify, my report shows the picture, but i just wonder how to do if i want to save the previous selected picture

    Thanks
    ______________

    Regards,
    Steven
  • mcapuccimcapucci Member Posts: 18
    export report in txt, copy the text esxported and paste it in a new message then i can look the problem....
    byebye
  • selece28selece28 Member Posts: 316
    Here it is
    OBJECT Report 123456761 Print Picture
    {
      OBJECT-PROPERTIES
      {
        Date=06/03/07;
        Time=15:47:41;
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
      }
      DATAITEMS
      {
        { PROPERTIES
          {
            DataItemTable=Table2000000026;
            DataItemTableView=SORTING(Number)
                              WHERE(Number=CONST(1));
            OnAfterGetRecord=BEGIN
                               recTempPic.FIND('-');
                               recTempPic.CALCFIELDS(Gambar);
                             END;
    
          }
          SECTIONS
          {
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=14250;
                SectionHeight=8037;
              }
              CONTROLS
              {
                { 1000000000;PictureBox;450;423 ;8700 ;6345 ;SourceExpr=recTempPic.Gambar }
              }
               }
          }
           }
      }
      REQUESTFORM
      {
        PROPERTIES
        {
          Width=9020;
          Height=3410;
        }
        CONTROLS
        {
          { 1000000000;TextBox;3630 ;330  ;4730 ;440  ;PermanentAssist=Yes;
                                                       CaptionML=ENU=Select Picture;
                                                       SourceExpr=PictPath;
                                                       OnAssistEdit=BEGIN
                                                                      //#1 Choose Picture to import (*.BMP)
                                                                      PictPath := CommonDialogMgt.OpenFile(text001, '', 4, 'Picture Files (*.BMP)|*.BMP|All Files (*.*)|*.*', 1);
    
                                                                      IF PictPath = '' THEN
                                                                         EXIT
                                                                      ELSE BEGIN
                                                                         //IF recTempPic.FIND('-') THEN
                                                                         recTempPic.Gambar.IMPORT(PictPath);
                                                                         //recTempPic.INSERT;
                                                                         //ELSE
    
                                                                      END;
                                                                    END;
                                                                     }
          { 1000000001;Label  ;220  ;330  ;3300 ;440  ;ParentControl=1000000000 }
        }
      }
      CODE
      {
        VAR
          PictPath@1000000000 : Text[1024];
          CommonDialogMgt@1000000001 : Codeunit 412;
          text001@1000000002 : TextConst 'ENU=Import Picture';
          PictureExists@1000000003 : Boolean;
          recTempPic@1000000004 : Record 50001;
    
        BEGIN
        END.
      }
    }
    


    Thanks
    ______________

    Regards,
    Steven
  • mcapuccimcapucci Member Posts: 18
    can you export the 50001 table also? thankyou
  • selece28selece28 Member Posts: 316
    Table 50001 is a table named Temp Picture
    only contain one field named Gambar with the type of BLOB

    Thanks
    ______________

    Regards,
    Steven
  • mcapuccimcapucci Member Posts: 18
    the problem is in the table 50001.
    Insert one record in the tabel (by hand) then modify your report like below



    IF PictPath = '' THEN
    EXIT
    ELSE BEGIN
    recTempPic.FIND('-');
    if recTempPic.Gambar.HASVALUE then
    clear(recTempPic.Gambar);
    recTempPic.Gambar.IMPORT(PictPath);
    recTempPic.MODIFY;
    END;


    I think the table 50001 dos'nt have one single item!
    It is better, first insert the record by the key then modify the picture.
  • mcapuccimcapucci Member Posts: 18
    the table must have at least two fields: first the key of the tabel (i.e. a numeric field) then the Gambar picture field.
    Is not possible work with a single piscture field in a table.
    byebye adg good luke!
    Mirko.
Sign In or Register to comment.