Array to record

I have an array that holds a certain amount of pictures. I want to save the array to a table.
I can save the array per element to a record but I want to save the array as in whole as I need it in whole.

How can I save the array to a record, and what type must the field be?

Create a second table for your pictures with three fields, the primary key, the foreign key, and your picture. Link those records back to your original record through the foreign key field. You can loop through the array and use DatabaseRecord.PictureColumn to insert the records. Use the TIFF format if size is not an issue and you want to ensure the original quality.

Hi Kem,

There is no way to convert this array to a byte stream or similar? I looked into MemoryBlock but I couldn’t figure out how to get it back to an array.

I guess you could convert each picture to a string with EncodeHex (or EncodeBase64) Picture.GetData, then create one huge string of all the pictures using Join and stuff it into your record. But I am recommending against that as it will make the record huge and will have other implications.

The “right” way to do it is the way I described. Any reason you prefer not to do it that way?

Either way, you must do each picture individually. There is no way to stuff an entire array into the database all at once.

Well, it is just that I’m lazy :wink:
I considered already storing the pictures in a separate table. That’s the way to go for now.

Thanks for your help.