[V4RB] RecID & picture fields
    Pedro fp 
    lists at pedro.Net.au
       
    Fri Sep 10 14:33:18 CDT 2004
    
    
  
G'day Folks
Thanks for replies thus far.
On 09/09/2004, at 5:04 PM, Francois Van Lerberghe wrote:
> RecID is not an uMediumField. It's an ULongField.
> Try this :
>         dRow( i ).itemData = data.ULongField( "RecID" ).value
That was plain daft of me. I tried ULongField on a punt just after I  
sent my question & that worked :)
> This code seems to be correct. I think you must test nil objet before.
> Try this :
>   dim tempPicture As Picture
>   dim pictureField As VPicture
>   tempPicture = data.PictureField( "photo" )
>   if pictureField <> nil
>     tempPicture = pictureField.GetPicture
>   end if
>   if tempPicture <> nil then
>     dRow( i ).icon = tempPicture
>   end if
>
> Have you set the currentPosition to the record you want to retrieve?
Yes. The block of code accessing my cursor is ...
       b = data.firstRecord()
       for i = 1 to data.recordCount ' Loop through the cursor to  
populate lists.
         dRow( i ) = new dataRow
         dRow( i ).itemData = data.uLongField( "RecID" ).value
         dRow( i ).icon = data.PictureField( "photo" ).getPicture ' Set  
photo icon.
         s(0) = data.stringField( "salutation" ).getString
         s(1) = data.stringField( "givenName" ).getString
         s(2) = data.stringField( "surname" ).getString
         dRow( i ).name = s
         dRow( i ).payrollNumber = data.stringField( "payNumber"  
).getString
         b = data.nextRecord()
       next
Now that the line getting the RecID is fixed the only part not working  
is the line getting the picture.
>>  me.fPhoto.setPicture( withFile.openAsPicture, 80 )
>
> You could test nil object with withFile.openAsPicture, just in case...
I have tried that but it hasn't made any difference. I'm now convinced  
that the problem is in getting the pictures into the database. When a  
new database is created the blob file is 100 KB. After importing a  
folder containing 329 files totaling 18.5 MB the blob file is still 100  
KB.
The method importing the files, with the test for nil on  
withFile.openAsPicture & also with the test for the file being a JPEG  
moved into that method, again is ...
Function newPersonFromJPEG( withFile As folderItem ) As integer
   dim dataString As string, iDate As new date, i, ln As integer, gt As  
boGlobals
   dim temp As picture
   if withFile.type = "image/jpeg" then
     ' do the stuff
     dataString = left( withFile.name, len( withFile.name ) - 4 )
     writeLog "dataString: " + dataString
     gt = winMain.mDatabase.tGlobals
     ln = gt.lastAdded + 1
     me.setBlank
     me.fLine.value = ln
     me.fDateAdded.set( iDate.year, iDate.month, iDate.day )
     for i = 0 to 1
       me.fName( i ).value = titlecase( nthField( dataString, " ", i + 1  
) )
     next
     if countFields( dataString, " " ) > 2 then
       me.fPayNumber.value = nthField( dataString, " ", 3 )
     end if
     temp = withFile.openAsPicture
     if temp <> nil then
       me.fPhoto.setPicture( temp, 80 )
     end if
     me.fLastModified.setDate( iDate.year, iDate.month, iDate.day )
     me.fLastModified.setTime( iDate.hour, iDate.minute, iDate.second )
     me.addRecord
     me.flush
     gt.lastAdded = ln
     writeLog "Imported!"
     return 1
   else
     return 0
   end if
End Function
Once again, any clues? It's important that I sort this one as the  
images are the primary data in this project.
Concerning Erne's suggestion that I need to convert to PICT first. The  
RB Language Reference clearly state that openAsPicture opens any image  
file that QuickTime can handle as a PICT so I don't believe that's the  
problem.
Cheers, Pedro :-)
Web: <http://www.pedro.net.au>                    PGP Key ID: 387CD96F
Instant messaging...  AIM: bandidoOfOz  ICQ: 27671678  Jabber: pedrofp
                       MSN: mail at pedro.net.au           Yahoo: pedro_fp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
~~~~
"The above message is encrypted with double rot13 encoding. Any  
unauthorized
attempt to decrypt it will be prosecuted to the full extent of the law."
                                                               origin  
unknown
    
    
More information about the Valentina
mailing list