Hi,
I'm trying to create a BLOB field where I want to upload a picture. I have a field type BLOB with the subtype property set to BitMap. There is no C/AL code in the field. Next, I have a form where I've copied the menu items pertaining to the Picture button on the Company Information form. I can't find any other C/AL code that needs to be copied, other than the code in the OnPush trigger to Import, Export, and Delete. With only minor alterations to the code, my code looks like this:
<Control1101101024> - OnPush() //IMPORT
SignatureExists := Signature.HASVALUE;
IF Signature.IMPORT('*.BMP',TRUE) = '' THEN
EXIT;
IF SignatureExists THEN
IF NOT CONFIRM(Text001,FALSE) THEN
EXIT;
CurrForm.SAVERECORD;
<Control1101101025> - OnPush() //EXPORT
IF Signature.HASVALUE THEN
Signature.EXPORT('*.BMP',TRUE)
ELSE
MESSAGE(Text003);
<Control1101101026> - OnPush() //DELETE
IF Signature.HASVALUE THEN BEGIN
IF CONFIRM(Text002,FALSE) THEN BEGIN
CLEAR(Signature);
CurrForm.SAVERECORD;
END;
END ELSE BEGIN
MESSAGE(Text004);
END;
SignatureExists is a variable of type Boolean (similar to PictureExists in the Company Information form) and Signature is the BLOB field.
For some reason, this doesn't work. I can't import the picture. There is no error message of any kind, but the picture just isn't imported to the record. I've tried importing the picture in the Company Information form, just to make sure that the picture matches any given criteria allowing it to be imported, and it worked fine.
If anybody has any suggestions on this, I would be very grateful.
Cheers!
Answers
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
If you are showing the picture in a report for example, you have to do CALCFIELDS before, or it won't show...
But still no picture.. The CALCFIELDS(Signature) is in the OnPreSection trigger in a footer section, but I've also tried it in the AfterGetRecord trigger.
I've also tried exporting the picture after importing it, with the C/AL code set up to deliver a message if there is no picture to export. When I try exporting the picture, the C/AL code returns this message.
What am I not seeing? ](*,) ](*,) ](*,)
Thanks for the help so far, though. Always appreciated. =D>
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
In case anybody else happens upon the same problem, the solution was to use CALCFIELDS(Signature) in the OnPush trigger before trying to export/delete the picture. I suppose this is necessary because the table I have the BLOB field in has multiple records, and Company Information, where the code was copied from, does not. Same problem with the picture box. On a tabular form, you have to use CALCFIELDS in the AfterGetRecord trigger to load the picture. This doesn't seem to be necessary on a card-type form though.
So after changing text box -> picture box and adding CALCFIELDS in all the right places, it works
Thanks for all the help! =D> =D> =D>
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
http://www.BiloBeauty.com
http://www.autismspeaks.org