Subject Re: field type binary not working on my form
From Mervyn Bick <invalid@invalid.invalid>
Date Mon, 11 Sep 2023 11:10:28 +0200
Newsgroups dbase.getting-started
Attachment(s) not_available.jpg

On 2023/09/11 06:18, AGOSTINHO wrote:
> Dear group I just add a field type binary to my dbf file, I place a picture in it but when I drop the field from the field palette  to the
> form it work OK when moving on the grid up and down but when doing a search
> then I get an program alert error windows:
> "Data type mismatch.  Expecting:  Object"
> when click on FIX
> it points to form.products1.requery()
> function ENTRYFIELD4_onKey(nChar, nPosition,bShift,bControl)
>        form.rowset.first()
>        form.products1.params['ag'] = '%'+this.value+'%'
> ==>  form.products1.requery()
> I would also like to know how do I EDIT-CHANGE-DELETE image when on the form, I don't see any option  how to program it from within the inspector.
> Thanks
> Agostinho

It looks as if you've caught yourself a real, live bug. :-)  If you
press the "Ignore" button and try again then it works without a problem.
  This makes it easy to create a work-around.

The work-around is

function ENTRYFIELD4_onKey(nChar, nPosition,bShift,bControl)
   //form.rowset.first() // This is not necessary.
   //A requery() with the argument '%...%' for the LIKE predicate
   //examines every record in the table.

   form.products1.params['ag'] = '%'+this.value+'%'
     form.products1.requery()  //If it doesn't work the first time
   catch(exception e)
     form.products1.requery()  //it will work the second time. :-)

To delete a picture one can't simply null the field in the table as
dBASE reports it as read-only.  I replace it (using replaceFromFile())
with a dummy picture which shows the text "Picture not available".  The
picture is attached if you care to use it.

To change a picture simply use replaceFromFile() to save a new picture
to the table.

To edit a picture one would need to export it from the table using
copyToFile(), edit it using an appropriate program and then use
replaceFromFile() to put it back into the table.

dBASE includes Fotografix.exe in the bundle and, according to the dBASE
2109 help file

RUN(true,"C:\Program Files (x86)\dBASE\Plus12\Bin\fotografix.exe

will open the program from within dBASE.  This works for me as I also
have dBASE Plus12 installed.

Fotografix.exe is also included with dBASE 2109 but

RUN(true,"C:\Program Files (x86)\dBASE\Plus2019\Bin\fotografix.exe

does NOT open the program on my computer.   Right-clicking on an image
in the Navigator in dBASE Plus 2019 does, however, allow me to open the
image in Fotografix.

That said, just because dBASE allows you to do something doesn't mean
you should.  There is a school of thought that holds that one shouldn't
save images in a table.  One should rather keep all images in a folder
and save the image name, including the path, to a text field in the
table.  One can use the rowset's onNavigate event handler to display the
image in an image control on the form as the user steps through the table.

The only time I would ever consider saving images to a BLOB field in a
table would be for identity photos and specimen signature where, for
security reasons, one wouldn't want the images freely available.  Even
then I would only consider this if the images were stored using a SQL
server.  Even there it is not really necessary as access control to any
file, including image files, is far tighter under SQL than with the BDE.


Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0