Export Picture Through Dataport

DevDev Member Posts: 74
Dear All

Is there any way by which we can import picture in item table through dataport.

Thanks In adavnce

Comments

  • garakgarak Member Posts: 3,263
    the dataport can't export per default BLOB values.

    But u can do this:
    OnAfterExportRec()
    
    calcfields(BlobField);
    if BlobField.hasvalue then begin
      BlobField.export(PATH + extension);
    end;
    

    I'm sure, if you saerch the forum for this, u fill find some topics about this thema.

    Regards
    Do you make it right, it works too!
  • DevDev Member Posts: 74
    Thanks for reply what is this "blobfield" also i have to import multiple pics ho i get their path one by one...

    plz suggest
  • garakgarak Member Posts: 3,263
    Dev wrote:
    Thanks for reply what is this "blobfield" also i have to import multiple pics ho i get their path one by one...

    plz suggest


    With BlobField i mean the Blobfield in your table.
    Example: In the Item Table there is a field called Picture. These field is of type BLOB. So, its a BLobField ;-)

    Do you want import or export BLOBs?
    Do you make it right, it works too!
  • DevDev Member Posts: 74
    I have to import..the pics....how will make the automatic to import.....
  • SavatageSavatage Member Posts: 7,142
    You could create a report using Item as your dataitem.

    How are your pictures named? the same as the item numbers or vendor item numbers?
    If they are named in a way that associates the pic and the item then it's easy.
    OnAfterGetRecord()
    CLEAR(Item.Picture);
    IF EXISTS ('C:\Pictures\'+Item."No."+'.BMP')
     THEN BEGIN
      Item.Picture.IMPORT('C:\Pictures\'+Item."No."+'.BMP',FALSE);
      Item.MODIFY;
    END;
    

    **C:\Pictures is a phony location of where pictures might be stored - just for use in the example. Change that part to where you actually have your pictures stored.
  • SavatageSavatage Member Posts: 7,142
    Dev wrote:
    what is this "blobfield"
    Here is a list of different fields:
    • Integer
    • Option (option string)
    • Boolean (check box)
    • Date
    • Code
    • Blob (binary large object, bitmaps pictures)
    • Time
    • Decimal
    • FlowField®
    • FlowFilter®

    Go Here: Scroll Down to the downloads.
    There are many useful PDF's available to help you understand your system better.
    http://www.microsoft.com/downloads/deta ... laylang=en
  • garakgarak Member Posts: 3,263
    store the bitmapfiles for the items in a folder where you have access. The bitmaps should have the item no. or the should have the same sort like the item sort (first bitmap is for the first iten and so on)

    If the item in your database and you need only to import the bitmaps, create, as Harry said, a report over the ITEM where do the following:
    //if the bitmapfile has the same name like the item no.
    
    Item - OnAfterGetRecord()
    if file.exists('PATH\'+"No."+'.bmp') then begin
      Picture.IMPORT('PATH\'+Item."No."+'.BMP',FALSE);
      modify;
    end;
    
    //or if the second file is for the second item or the first file is for the fist item and so on
    Item - OnPreDataItem()
    Filerec.reset;
    Filerec.setrange(Path,'YourPathTotheFiles');
    Filerec.setrange("Is a file",true);
    Filerec.setfilter(Name,'*.bmp');
    FileExist := Filerec.findset;
    
    Item - OnAfterGetRecord()
    if FileExist then begin
        Picture.IMPORT(FileRec.Path+FileRec.name,FALSE);
        modify;
        FileExist := FileRec.next <> 0;
    end;
    

    If you want to import the items AND the bitmaps in a Dataport, you can use the same principle in the dataport
    Do you make it right, it works too!
Sign In or Register to comment.