Export pictures...

bin-doph
Member Posts: 4
Hi community,
I'm trying to export all the pictures from table contact to my local filesystem (I do have an old database and only the pictures are needed to import in my actual database). I'm pretty new to navision and tried a couple of stuff, but I always end up in having "functional code, what does not what I expect". I keep getting no images exported this way:
I commented out the debugging stuff, but my .HASVALUE-condition seems never to be true :?
thx for any piece of help in my noob-quest in advance
-fe
I'm trying to export all the pictures from table contact to my local filesystem (I do have an old database and only the pictures are needed to import in my actual database). I'm pretty new to navision and tried a couple of stuff, but I always end up in having "functional code, what does not what I expect". I keep getting no images exported this way:
IF contact.FIND('-') THEN BEGIN // MessageCount := 1; REPEAT // MessageCount := MessageCount + 1; // IF (MessageCount < 10) THEN // MESSAGE('currently working' + contact."No."); // Check if image exists and export IF (contact.Picture.HASVALUE) THEN //BEGIN // MESSAGE('Exportiere Bild von Kunde ' + contact."No."); contact.Picture.EXPORT('C:\navision_images\' + contact."No." + '.BMP',FALSE) // END // ELSE // IF (MessageCount < 20) THEN // MESSAGE('%1 has no image', contact."No."); UNTIL contact.NEXT = 0; END;
I commented out the debugging stuff, but my .HASVALUE-condition seems never to be true :?
thx for any piece of help in my noob-quest in advance
-fe
0
Comments
-
Add
contact.calcfields(Picture)
after the Repeat
thus resulting in:
Code:IF contact.FIND('-') THEN BEGIN // MessageCount := 1; REPEAT contact.CALCFIELDS(Picture); // MessageCount := MessageCount + 1; // IF (MessageCount < 10) THEN // MESSAGE('currently working' + contact."No."); // Check if image exists and export IF (contact.Picture.HASVALUE) THEN //BEGIN // MESSAGE('Exportiere Bild von Kunde ' + contact."No."); contact.Picture.EXPORT('C:\navision_images\' + contact."No." + '.BMP',FALSE) // END // ELSE // IF (MessageCount < 20) THEN // MESSAGE('%1 has no image', contact."No."); UNTIL contact.NEXT = 0; END;
The calcfields is necessary because of the fact that the Picture
field is a BLOB field.
RegardsNow, let's see what we can see.
...
Everybody on-line.
...
Looking good!0 -
thx a lot!0
-
Hey! Could this code be also used in other way - to import pictures for Items? Thanks alot. #-o0
-
Alesh77 wrote:Hey! Could this code be also used in other way - to import pictures for Items? Thanks alot. #-o
I don't know... I basically don't know if it's possible to glob for files in a directory and to extract information out of the filename (which would be the no. so just the .BMP is dropped). But the import-function is there so I guess it should be possible...somehow...GoMaD wrote:contact.calcfields(Picture)
I run that code using calcfields and it did what I wanted. I uncommented my debugging-messages, but it didn't do what I expect, as I said, I'm not that experienced yet, but maybe you could give me some further explaination. I expected something like that:-
get record
tell me what record it is ("currently working on...")
check if hasvalue
yes: tell me and export
no: tell me a (max 20 times)
What I saw was something different. First all pictures got exported (that took a lot of time, load of pics, that's why I mentioned it), then I had to click away my nasty debug messages. Also the references I have (printouts and onlinehelp) tell me that calcfields is only used to refresh flowfields, but IMHO Picture is not a flowfield (or am I wrong here?)
Would be nice, if someone could briefly explain that behaviour to me, thx in advance
-fe0
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