Read an external bitmap file

atankersley
Member Posts: 32
I have item pictures for 20,000 items. What I want to do is store the pics in an external file and read them into the item card on the fly for display. I thought I could use an instream, but I am hung up on how to read the bmp file with the instream I created from the Item.Picture.CREATEINSTREAM(). I would be very thankful for any insite on this.
tank
0
Answers
-
http://www.mibuso.com/forum/viewtopic.php?t=16184
they key here is to have the picture name the same as the item no.On the Item Picture Form OnAfterGetRecord() Code: SETRANGE("No."); IF EXISTS ('P:\BMP\'+"No."+'.BMP') THEN Picture.IMPORT('P:\BMP\'+"No."+'.BMP',FALSE); CALCFIELDS(Picture); That's it - now your pic will show.
note p:\bmp\ is the drice & directory where we store our pictures. change it to fit your drive & directory names
as Kriki or Alex stated in another post - if you are using ver5 you can link the pic just as you link different external docs.0 -
note adding CLEAR(Picture);
OnModify of the item table. insures the pic won't be saved while viewing the pic and someone makes a change on that item.
Note: If you modified your item card to show the picture in a picture box then add the code to the item card not the item picture form0 -
last thought: assuming you're never imported pictures then go ahead and use the above code. If you have already imported pictures and want to clear them from Item.Picture blob without having to go one by one.
create a report based on the item table.OnAfterGetRecord() IF Item.Picture.HASVALUE THEN CLEAR(Item.Picture); Item.MODIFY;
did i miss anything? :-k0 -
OOOH!
If you don't have access to the code on the forms & tables.
You can Create a Report based on the item table.
View the sections and put 1 big picture box with sourexp as Picture
add the codeOnAfterGetRecord() IF EXISTS ('P:\BMP\'+"No."+'.BMP') THEN Picture.IMPORT('P:\BMP\'+"No."+'.BMP',FALSE); CALCFIELDS(Picture);
Now on the item card add a command button
PushAction:RunObject
The object will be this report.
Unfortunately at this point you will need to transfer the parameter of which item your on tot he report, which will require some more coding but if you ok with manually entering the No - this way will work too
Not as pretty & nice thou.0 -
Thanks alot Savatage. Your code worked perfectly.tank0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions