Library Lookup - Open document from link

Hi,
I have a document library lookup, based on a calculated field. Is there any way I can get the link to actually open the document itself, rather than just the info on the document? This seems to be a very difficult task in sharepoint, as by lookups don't seem to be able to open the actual document.

I basically need the user to be able to select (multiple) policy documents from a main document library, and be able to directly open the documents from the Display View of a form.

Many thanks

Dear @traveller,
Took a long time to test, but here's something you can try:

fd.spRendered(function() {
    fd.control('SPDataTable1').templates = {
        Lookup: function(ctx) {
            var value = ctx.row.Lookup;
            if (!value) {
                return '';
            }
            
            pnp.sp.web.lists.getByTitle('Documents').items.select("Id,Title,EncodedAbsUrl").get().then(function(docs){
                console.log(docs);
                for(var i = 0; i < docs.length; i++){
                  if(docs[i].Id == value[0].lookupId){
                    console.log(docs[i]);
                    $('#doclink__' + ctx.row.ID).attr('href',docs[i].EncodedAbsUrl);
                  }
                }
                
            });
            return '<a id="doclink__' + ctx.row.ID + '">' + value[0].lookupValue + '</a>';
        }
    }
})

Replace Internal Name for Lookup column, Document Library title and List or Library Name, and you should be good to go.

That's great!
Thanks so much - I couldn't figure it out