{"id":10440,"date":"2018-11-14T11:50:30","date_gmt":"2018-11-14T17:50:30","guid":{"rendered":"http:\/\/www.mrc-productivity.com\/techblog\/?p=10440"},"modified":"2023-08-08T12:24:30","modified_gmt":"2023-08-08T18:24:30","slug":"rendering-blob-fields","status":"publish","type":"ht_kb","link":"https:\/\/www.mrc-productivity.com\/techblog\/?ht_kb=rendering-blob-fields","title":{"rendered":"Rendering BLOB Fields"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Overview<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Implementation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">First you will need to create a Single Row Data List Retrieval over the table containing your BLOB field. In this retrieval, you&#8217;ll want to select a dimension 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. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DICTIONARY.I00010s?slnk=1&amp;SOMEKEY=${row.SOMEKEY}&amp;downloadbinary=1&amp;filefield=MYBLOBFIELD&amp;file=${row.FILENAME}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Using the above code excerpt as an example, the following values are explained:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>slnk=1<\/code><\/strong> <em>(required)<\/em> Smartlink parameter to return the specific record found based off the dimension key(s) passed. <\/li>\n\n\n\n<li><strong><code>SOMEKEY=${row.SOMEKEY}<\/code><\/strong><em>(required)<\/em> Replace &#8216;SOMEKEY&#8217; with the fieldname of your sequence key. Repeat this for as many sequence keys in your app.<\/li>\n\n\n\n<li><strong><code>downloadbinary=1<\/code><\/strong> <em>(required)<\/em> Triggers the necessary logic to render the BLOB.<\/li>\n\n\n\n<li><strong><code>filefield=MYBLOBFIELD<\/code><\/strong> <em>(required)<\/em> Replace &#8216;myblobfield&#8217; 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.<\/li>\n\n\n\n<li><strong><code>file=${row.FILENAME}<\/code><\/strong> <em>(required)<\/em> Replace &#8216;filename&#8217; with the fieldname of the filename field. 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.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The downloaded file type will pull from file extension in the &#8216;file&#8217; URL parameter. The following common file types are automatically recognized without any additional parameters:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>xls, xlsx, xml, pdf, csv, txt, jpeg, png, gif<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If your document type is not listed above. You may pass the following optional parameter in the smartlink URL to identify the content type:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>contentType=[contentType]<\/code><\/strong> <em>(optional)<\/em> Replace &#8216;[contentType]&#8217; with the appropriate MIME type (i.e. contentType=application\/json). A quick internet search for MIME content type should give you the value needed.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Overview 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. Implementation First&#8230;<\/p>\n","protected":false},"author":10,"comment_status":"closed","ping_status":"open","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[],"ht-kb-tag":[],"class_list":["post-10440","ht_kb","type-ht_kb","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.mrc-productivity.com\/techblog\/index.php?rest_route=\/wp\/v2\/ht-kb\/10440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mrc-productivity.com\/techblog\/index.php?rest_route=\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.mrc-productivity.com\/techblog\/index.php?rest_route=\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/techblog\/index.php?rest_route=\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/techblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10440"}],"version-history":[{"count":12,"href":"https:\/\/www.mrc-productivity.com\/techblog\/index.php?rest_route=\/wp\/v2\/ht-kb\/10440\/revisions"}],"predecessor-version":[{"id":12068,"href":"https:\/\/www.mrc-productivity.com\/techblog\/index.php?rest_route=\/wp\/v2\/ht-kb\/10440\/revisions\/12068"}],"wp:attachment":[{"href":"https:\/\/www.mrc-productivity.com\/techblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10440"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/techblog\/index.php?rest_route=%2Fwp%2Fv2%2Fht-kb-category&post=10440"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/techblog\/index.php?rest_route=%2Fwp%2Fv2%2Fht-kb-tag&post=10440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}