Solved

How can I use a expression field with a query to a column with binary data for the preview component?

  • 15 March 2021
  • 2 replies
  • 141 views

Userlevel 4
Badge +11

How can I use a expression field with a query to a column with binary data for the preview component? I've add an expression field with the following select query:

select CONVERT(VARBINARY(5000),file_upload)
from project_order_document
where project_document_id = 213 

The column contains the binary data of a .pdf file but the previewer shows the text "No filepath is given”.

The domain has datatype VARBINARY_MAX without user interface control. If I try to change it into "File link” it changed automatically to "File upload". 

 

icon

Best answer by Vincent Doppenberg 15 March 2021, 21:12

View original

2 replies

Userlevel 6
Badge +4

Hello Dennis,

You're halfway there. You’ll need another column to which you have to assign a database storage configuration. This column can simply use a varchar or nvarchar data type and should be assigned a File upload control. The expression column which you've already created needs to be assigned to the new column as the storage column.

 

So, to summarize:

  1. Create a column with a domain that has a database storage location and a file/image upload control. This domain can simply be (n)varchar.
  2. Create an expression column with a varbinary(max) domain and select the varbinary value in the expression. The control of this domain doesn't matter.
  3. Assign the second column as the storage column of the first column.

Hope this helps.

Userlevel 7
Badge +23

Sub forum changed to Questions & Conversations.

The ThinkStore sub forum and its categories are meant for code samples :wink:

Reply