It is currently 6 December 2022, 21:23 Advanced search

Store BLOB files in native and non-native formats

Questions and answers on how to best use Instant Developer

Store BLOB files in native and non-native formats

Postby ATroyer » 29 June 2022, 15:36

I am trying to store BLOB files (png images) in a format that can be used both in INDE and in external applications. I read this post https://forum.instantdeveloper.com/viewtopic.php?f=5&t=87050&hilit=base64+blob, but I am not interested in converting files to Base64.

Is there any way to store images in two separate database fields, one compatible with INDE (Native BLOB unchecked in Compiling Parameters) and the second readable by outside reporting engines (Native BLOB checked)? Possibly an automatic conversion when uploading a BLOB file? I want to be able to use reports from both within and outside of INDE.

I know this may not be the most efficient way to store data. However, the image files are very small, so I do not care about storage efficiency.
ATroyer
 
Posts: 51
Joined: 30 October 2019, 13:30

Re: Store BLOB files in native and non-native formats

Postby ljwilson » 29 June 2022, 21:07

I guess you could create a second application or component in your project and set the blob format in the parameters for it to native, leaving non-native checked in your original app.

Then call your blob methods from one or the other depending on what you want to do.

...jack
ljwilson
 
Posts: 678
Joined: 26 November 2013, 14:15

Re: Store BLOB files in native and non-native formats

Postby ATroyer » 2 July 2022, 23:52

Tried that with no luck; I may not have played around with it enough.

What does seem to work is to attach a procedure that fires after uploading a blob through the app. This procedure constructs and runs a SQL query that loads the image file into a database table not managed by INDE. This table also contains the primary key of the record that was just saved by the app, so that an external reporting app (I am currently playing around with Bold Reports from Syncfusion) can connect the tables.
ATroyer
 
Posts: 51
Joined: 30 October 2019, 13:30

Re: Store BLOB files in native and non-native formats

Postby ATroyer » 4 July 2022, 14:30

A little more detail:
I created a separate attachment table with a ParentID field (GUID) functioning as a foreign key to multiple tables. I wrote a procedure as follows, which can be used in Before BLOB Update and After Save events:

Screenshot 2022-07-04 102412.png
Screenshot 2022-07-04 102412.png (59.67 KiB) Viewed 484 times
ATroyer
 
Posts: 51
Joined: 30 October 2019, 13:30

Re: Store BLOB files in native and non-native formats

Postby ljwilson » 6 July 2022, 12:14

Good stuff Allen, thanks for figuring that one out! Might come in handy for me someday.

...jack
ljwilson
 
Posts: 678
Joined: 26 November 2013, 14:15


Return to Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests

cron