Delete Pic After Import

Savatage
Member Posts: 7,142
After Importing an Items' Picture. I would like it to ask if I want to delete file file off the drive.
But unlike a dataport where I can
Put the following Code in the OnPost Dataport Trigger
I can't seem to get it to work on the Item->Pic->import
I'm sure it's right in front of my face
OnPush() PictureExists := Picture.HASVALUE; IF Picture.IMPORT('*.BMP',TRUE) = '' THEN EXIT; IF PictureExists THEN IF NOT CONFIRM(Text001,FALSE,TABLECAPTION,"No.") THEN EXIT; CurrForm.SAVERECORD;
But unlike a dataport where I can
Put the following Code in the OnPost Dataport Trigger
CurrFile.CLOSE; IF Confirm(Text000, true) then ERASE(CurrDataport.FILENAME); Where Text000 = 'Would you like to delete the file?'
I can't seem to get it to work on the Item->Pic->import
I'm sure it's right in front of my face
0
Answers
-
Hi Harry
The Picture.IMPORT returns the filename
If you save this in a variable you can use the ERASE fucntion to delete the file after it is stored in the databaseFileName := PICTURE.IMPORT(...) IF FileName = '' then exit ... ERASE(FILENAME);
0 -
PictureExists := Picture.HASVALUE; IF Picture.IMPORT('*.BMP',TRUE) = '' THEN EXIT; IF PictureExists THEN IF NOT CONFIRM(Text001,FALSE,TABLECAPTION,"No.") THEN EXIT; CurrForm.SAVERECORD; ImportedPicture := ('S:\'+"No."+'.BMP'); IF CONFIRM(Text003,TRUE,ImportedPicture) THEN ERASE(ImportedPicture);
Name ConstValue
Text003 Do you want to delete the file %1 from Drive0 -
-
Harry
What part of my example do you not understand?????
The Picture.IMPORT returns the selected file including the location!!!
Let me know if you need any help.0 -
I understand what you said but I kept on getting an error on the filename when I tried to pass it to the variable.0
-
-
This code works like a charm
PictureExists := Picture.HASVALUE; FileName := Picture.IMPORT('*.BMP',TRUE); IF FileName = '' THEN EXIT; IF PictureExists THEN IF NOT CONFIRM(Text001,FALSE,TABLECAPTION,"No.") THEN EXIT; CurrForm.SAVERECORD; IF EXISTS(FileName) THEN ERASE(FileName);
0 -
You are correct - My code had a typo error & I bailed too quickly on it.
PictureExists := Picture.HASVALUE; ImportedPicture := Picture.IMPORT('*.BMP',TRUE); IF ImportedPicture = '' THEN EXIT; IF PictureExists THEN IF NOT CONFIRM(Text001,FALSE,TABLECAPTION,"No.") THEN EXIT; CurrForm.SAVERECORD; IF EXISTS(ImportedPicture) THEN IF CONFIRM(Text003,TRUE,ImportedPicture) THEN ERASE(ImportedPicture);
0 -
OK
Thought I went crazy :shock:
Glad it works now.0 -
Talk about tweaking.
Very Customized Database - Upgrading is not an option anymore0
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