Importing a Picture in Navision through Dataports

write2sourav
write2sourav Member Posts: 113
Hi,
I have 100 pictures for 100 items for the item card. Is it possible to import all those pictures through a dataport or do i have to follow a manual process to inport them for each item. Plz help.

Comments

  • Marcel_G.
    Marcel_G. Member Posts: 6
    Make a Report (DataItem= Item) with a request-form where you place a textbox with the SourceExpression FilePath.

    Global Variable : 'FilePath' Datatype=Text / Lenght 1024
    Local Variable : 'PicFileName' Datatype=Text / Lenght 1024

    In the OnafterGetRecord():
    IF Picture.HASVALUE THEN
    CLEAR(Picture);
    PicFileName := STRSUBSTNO('%1%2.bmp',FilePath,"No.");
    IF FILE.EXISTS(PicFileName) THEN BEGIN
    Picture.IMPORT(PicFileName,FALSE);
    MODIFY;
    END;


    Lets say your picturefiles are on C:\Temp\pictures\ and the name of your pictures are starting with No. (Field No. in Item).BMP
    Type the path (C:\Temp\pictures\) in the textbox from the Report Request Form and push Run...
  • kine
    kine Member Posts: 12,562
    You can import them with anything. You just needs to know which picture file is connected to which record (it can be in some file - <RecID>,<filename>) etc. After that, you just needs to iterate through all the records and import the correct picture into it.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Savatage
    Savatage Member Posts: 7,142
    If each picture is named the same as it's item number it's a piece of cake.
  • Marcel_G.
    Marcel_G. Member Posts: 6
    If each picture is named the same as it's item number it's a piece of cake.

    If not, then maybe you can use a little help from a File renamer. (http://www.sherrodcomputers.com/products_filerenamer.cfm or other programs... ?)

    Making it 'a piece of 2 cakes'? :)

    _______________________________________
  • anil123
    anil123 Member Posts: 47
    Marcel G. wrote:
    Make a Report (DataItem= Item) with a request-form where you place a textbox with the SourceExpression FilePath.

    Global Variable : 'FilePath' Datatype=Text / Lenght 1024
    Local Variable : 'PicFileName' Datatype=Text / Lenght 1024

    In the OnafterGetRecord():
    IF Picture.HASVALUE THEN
    CLEAR(Picture);
    PicFileName := STRSUBSTNO('%1%2.bmp',FilePath,"No.");
    IF FILE.EXISTS(PicFileName) THEN BEGIN
    Picture.IMPORT(PicFileName,FALSE);
    MODIFY;
    END;


    Lets say your picturefiles are on C:\Temp\pictures\ and the name of your pictures are starting with No. (Field No. in Item).BMP
    Type the path (C:\Temp\pictures\) in the textbox from the Report Request Form and push Run...
    Anil
  • Marcel_G.
    Marcel_G. Member Posts: 6
    hai ............how to convert the jpg picture to bmp pictur

    Here I use the batch-option 'Export' to BMP from Macromedia FireWorks.
    But there are more graphic programs that have 'a look a like' batch propertie for converting directories with JPG, JPEG pictures to BMP at once.

    ________________________