newbie display external pdf from button

Hi i am still very new to scriptcase
I am attempting to make an online library of external pdf files
I have a database where a field named db_location contains the exact url to the pdf file like http://mysite/pdf/adocument.pdf
when I format the field as ‘url’ it displays in a grid and is clickable and the pdf displays as it should
I would like to hide the actual url address from the grid and display the pdf from a clickable button
I have tried sc_link and sc_redir without any success
Can one of you kind people please help me

There are two options. The first option is to create a blank application where you set the php headers the correct way so that the pdf will be downloaded.
Second option is not to enter the full path but just the filename, then setup a field with filetype ‘file’ and set the correct download path (in the preferences, and when you deploy in the advanced deploy). Then things will be generated by scriptcase. If you want to make it most easy then use the default folders afaik /files/downloads, but that’s easy to find out by yourself by creating an upload field and locate the file in your directory. By button is also possible, but only at the first approach. Do a sc_redir to your blank application passing the filename as a global (basic form of the macro): sc_redir(‘myblank.php’,myfile=’\myfile.pdf’);

Thanks Albert
Will try to work through your advice
Could you explain the following in a little more detail
“If you want to make it most easy then use the default folders afaik /files/downloads, but that’s easy to find out by yourself by creating an upload field and locate the file in your directory.”
Thanks mate
Most helpfull
John

I would try something like this:

  • Don’t format db_field as URL and hide it

  • create an HTML Image field and pick the image you like

  • in the onrecord event add this: sc_link({image_field}, {db_field}).;

If the pdf are external to SC, I would try something like this:

  • don’t format db_location as URL and hide it

  • create a field of type HTML image and pick the image you like

  • onRecord add this: sc_link({image_field}, {db_field})

Not sure sc_link will work with html image fields. In that case you can create a text field instead and populate it manually with the html IMG tag.