Hi! I'm building an image gallery page. The pictures should not be stored to the database but to the server folder. I am able to implement this by importing the file to the temporary table Media or MediaSet field Rec."Picture Media".ImportFile(FilePath, '');
I notice that each time when creating the temporary records, the Tenant Media records are created. I guess, that will consume a lot of space in database. In cloud version the media records are not included to the database size but in OnPrem they are.
I wonder if I could use the existing Tenant Media record on my temporary record instead of importing the file each time and creating new Tenant Media record. Tenant Media record holds a file name, there is no problem to find that. If I could find the corresponding Tenant Media Set record, I could copy the "Media ID" (type Media) to the temporary record field. However, I don't find a way to get the correct Tenant Media Set record.
1) how to find an existing Tenant Media Set record using the file name?
2) how could I clean the Tenant Media records? Do I need to delete the records myself, is the field "Expiration Date" that does it for me or some other way?