How to Modify Villeroy's Hyperlink Buttons Code?

Discuss the database features

How to Modify Villeroy's Hyperlink Buttons Code?

Postby kq76 » Fri Nov 27, 2020 7:46 pm

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 ... video_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)
kq76
 
Posts: 7
Joined: Sun Feb 12, 2012 12:36 am

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

Postby Villeroy » Fri Nov 27, 2020 7:54 pm

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   Expand viewCollapse view
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
User avatar
Villeroy
Volunteer
 
Posts: 29726
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Base

Who is online

Users browsing this forum: No registered users and 5 guests