Skip to main content

We currently have an attachment table with file_name and as domain control : File Upload.

 

Now we want to if someone clicks on that file name in the application. They will NOT be redirected to google chrome / internet explrorer to open that document.

 

Is there a way we can achieve that somehow?

Hi Anthony,

You can decide to use an expression column that takes the value of the File name field and presents it as Text rather than a File upload field. With a Layout procedure, you can make sure you see the Text in Navigation mode, whilst seeing the File upload field in Add/Edit mode.

Hope this helps!


Hi Mark,

 

I have a question on your follow-up. Using with the layout procedure. How can I change it to text? Because I`ve tried this multiple times with no succes

 

@file_name              "file_name",

 

Do I just do like? : 

SET @file_name = 'nvarchar_max_dom'

 


Hi Anthony,

Not quite, the Layout procedure can only affect the Visibility of fields and tell the GUI to make fields Mandatory.

Let's say you have the following in your table:

col_id int (primary key)

file_name varchar(1000) 

file_data varbinary(max)

file_name_text varchar(1000)

 

The column file_name has a domain with the File upload control, whilst file_name_text does not have the same domain but rather uses a generic domain that is simply a varchar(1000) and has no control).

File name text is an expression column that uses the following query to obtain its value:

t1.file_name

Indeed, nothing more, nothing less😃

 

In your Layout procedure for the desired table, write the following:

if @layout_mode = 2 -- Navigation
begin
set @file_name_type = 3 -- Hidden outside form, shows expression column instead
end
else -- Add or Edit mode
begin
set @file_name_text_type = 3 -- Hidden outside form, shows File upload column instead
end

This will ensure that when you are Adding or Editing a record, the File upload field is shown, whilst in Navigation mode the File name text field is shown instead. Note that this only functions in the Form. The grid cannot interpretate the _type parts of the Layout procedure.

This should do the trick, let me know 😄


This did the trick. But sadly not the expected result that I wanted.

 

Although this is in a form. The way we have It with our files is that we display it as a grid. Like this :

 

Is there a possible way to achieve that?


One way I can think of, not ideal but does the job, is having a circle reference on that table, that uses a Table variant in which the file_name_text column is shown in the grid. But that also requires the screen type to only show the Grid for the variant, have a Detail tab container with the same table, but then only showing the Form, that uses either its own variant or the original table.

So then you have
Grid - Table A, variant A - show file_name_text in grid (does show details - circle reference)

Form - Table A, (variant 😎 - show file_name (show no details)

Screen type having Grid and Detail tab container, Variant B using a Form only screen type

Hope it gives some inspiration 😄