Hello
I have a report where I want to embed a hyperlink to link to another system and I have tried various approaches but with everything I try either both the starting and ending speechmarks/tick marks/back ticks are automatically converted to the equivalent HTML character code which is then passed to the URL being opened resulting in an error.
An example URL I want to open is:
[http://SERVER/ProMonitor/ilp/meetingscomments/meetings.aspx?academicyearid=2223&pmstudentid=kYtgI8P%2b9GA%3d]
This should be able to be achieved with the following:
javascript:void(window.open('http://SERVER/ProMonitor/ilp/meetingscomments/meetings.aspx?academicyearid=2223&pmstudentid=kYtgI8P%2b9GA%3d'))
However it gets inserted as (from hovering over the link or right-clicking and selecting the copy link option):
javascript:void(window.open('http://SERVER/ProMonitor/ilp/meetingscomments/meetings.aspx?academicyearid=2223&pmstudentid=kYtgI8P%2b9GA%3d%27))
This passes a spurious %27 on the end which then causes the record it should load not to be found.
If I remove the speechmark then the link does not work and nothing happens. If I replace the ' with " then I end up with %22 at the start and the end. If I replace with the back tick then I end up with %60 at the start and the end.
I have tried:
- Using speeckmarks, tick marks and back ticks
- Putting the JavaScript part in the expression where the database field contains only the URL
- Combining the JavaScript and URL into the database field
- Creating a user defined function in the report code where I can pass the URL to the function
Whatever I try, the output is identical and at least the closing speechmark is converted to its HTML equivalent and passed to the URL
This is an example of a user defined function I created:
Function OpenURL(ByVal URL As String) As String
Return "javascript:void(window.open('" & URL & "','_blank'))"
End Function
Any help would be appreciated as I feel I have exhausted all options on what I thought would be something really quick and easy.
EDIT
I had a further idea which was to add & to the end of the URL so the pmstudentid parameter ends up intact and then it ends with &%27 however this still errored
Upon further checking, if I disable my internet connection (as the URL results in an instant redirect to an error page on the target application) I end up with the code at the end being translated from:
&pmstudentid=kYtgI8P%2b9GA%3d
To
&pmstudentid=kYtgI8P+9GA=
So it would appear this is actually the real issue although if I copy and paste the URL in Edge it still shows the + as %2B as it should.
I just need it not to convert back and forth between HTML character codes and ASCII codes
This is the reference I used to double check the character encoding:
https://www.w3schools.com/tags/ref_urlencode.ASP
Thanks
Robin