Rendering BLOB Fields

BLOB fields are becoming a more relevant and standard method of storing documents. Because of this, the decision was made to implement the ability to render and download files stored in a BLOB field with m-Power. This feature is available as of the December 2018 m-Power update.

First you will need to create a Single Row Data List Retrieval over the table containing your BLOB field. In this retrieval, you’ll want to sequence by the field(s) which make the record unique. Include any other fields that are associated with the BLOB field, such as a separate field for the filename. Once you have the Single Row Data List Retrieval compiled, we will be calling this using a smartlink. Here is an example of a smartlink URL you would create via m-Painter:

?slnk=1&SOMEKEY=${row.SOMEKEY}&downloadbinary=1&filefield=MYBLOBFIELD&file=${row.FILENAME}

  • slnk=1: (required) Smartlink parameter to return the specific record found based off the sequence key(s) passed in next parameter.
  • SOMEKEY=${row.SOMEKEY}: (required) Replace ‘SOMEKEY’ with the fieldname of your sequence key. Repeat this for as many sequence keys in your app.
  • downloadbinary=1: (required) Triggers the necessary logic to render the BLOB.
  • filefield=MYBLOBFIELD: (required) Replace ‘myblobfield’ with the fieldname of your BLOB field. Identifies the field in your application which contains the BLOB. This is useful if you have multiple BLOB fields in your table.
  • file=${row.FILENAME}: (optional) Replace ‘filename’ with the fieldname of the filename field if applicable. The value in this parameter will dictate what the BLOB download file will be named. This can be a dynamic field substitution or a hardcoded value.

The downloaded file type will pull from file extension in the ‘file’ URL parameter. The following common file types are automatically recognized without any additional parameters:

xls, xlsx, xml, pdf, csv, txt, jpeg, png, gif

If your document type is not listed above. You may pass the following optional parameter in the smartlink URL to identify the content type:

  • contentType=[contentType]: (optional) Replace ‘[contentType]’ with the appropriate MIME type (i.e. contentType=application/json). A quick internet search for MIME content type should give you the value needed.

Related Posts:

  • No Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *