How to Modify Villeroy's Hyperlink Buttons Code?

Discuss the database features
Post Reply
kq76
Posts: 7
Joined: Sun Feb 12, 2012 12:36 am

How to Modify Villeroy's Hyperlink Buttons Code?

Post by kq76 »

Is there a way I can modify Villeroy's code to make it so that it could say pull up a link that has the same prefix and/or suffix every time, just that it would take the middle part of a link from the database field every time?

For example, the URL would be https://en.wikipedia.org/w/index.php?ti ... ideo_game) , but the only part that would change depending on the record is the "A_Hat_in_Time" part, all the rest would be the same every time. Is there a way to do that?
OpenOffice 4.1.1 on Windows 10 (as of November 2015)
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: How to Modify Villeroy's Hyperlink Buttons Code?

Post by Villeroy »

You don't have to modify anything in that code.
If your column stores titles such as "A_Hat_in_Time", all you need is a simple query which concatenates the constant part(s) with the field value

Code: Select all

SELECT *,
  'https://en.wikipedia.org/w/index.php?title=Special:Search/' || "Title" AS "Search URL"
FROM "Table"
where "Table" and "Title" are the names of table and column and "Search URL" is an arbitrary column label for the concatenation.

Object names in "double quotes" (unquoted in spreadsheet formulas), literal strings in 'single quotes' ("double quoted" in sheet formulas), || is the concatenation operator (& in spreadsheets), SELECT * selects all columns.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply