Use another column data in URL

Hey all - I am trying to use an Entity Key/ID as part of a URL on another field = eg HTTP://somesite/{{entitykey}}.
The only way I can get the variable to appear is to ensure the entity key is viewable as a column. If I remove it the URL simply becomes HTTP://somesite/.
I have trawled through the list of issues and tried searching for this issue, but didn't have any luck.
Thanks.

Hi @amosm
Post "Diagnostic Info" from Admin > Troubleshooting.
If you are not using the latest release, then upgrade: https://github.com/metabase/metabase/releases/latest

{
"browser-info": {
"language": "en-US",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "Cp1252",
"java.runtime.name": "Java(TM) SE Runtime Environment",
"java.runtime.version": "1.8.0_311-b11",
"java.vendor": "Oracle Corporation",
"java.vendor.url": "http://java.oracle.com/",
"java.version": "1.8.0_311",
"java.vm.name": "Java HotSpot(TM) 64-Bit Server VM",
"java.vm.version": "25.311-b11",
"os.name": "Windows Server 2019",
"os.version": "10.0",
"user.language": "en",
"user.timezone": "Australia/Sydney"
},
"metabase-info": {
"databases": [
"h2",
"sqlserver"
],
"hosting-env": "unknown",
"application-database": "h2",
"application-database-details": {
"database": {
"name": "H2",
"version": "1.4.197 (2018-03-18)"
},
"jdbc-driver": {
"name": "H2 JDBC Driver",
"version": "1.4.197 (2018-03-18)"
}
},
"run-mode": "prod",
"version": {
"tag": "v0.41.2",
"date": "2021-11-09",
"branch": "release-x.41.x",
"hash": "ad599fd"
},
"settings": {
"report-timezone": "Australia/Victoria"
}
}
}

@flamber - does that tell you anything?

@amosm
The columns you want to include in the URL has to be part of the results.
So you would either need to create a Custom Column, or hide the column on the dashboard card, which only hides the column while still keeping it as part of the results.

You should upgrade to Java 11:
https://www.metabase.com/docs/latest/operations-guide/java-versions.html
And migrate away from H2 if you're using Metabase in production:
https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html

The columns are included as per the images below. I will look at moving Java and moving to production DB too.


No change with Java. Will look at DB tomorrow:

{
"browser-info": {
"language": "en-US",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "Cp1252",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.13+8",
"java.vendor": "Eclipse Adoptium",
"java.vendor.url": "https://adoptium.net/",
"java.version": "11.0.13",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.13+8",
"os.name": "Windows Server 2019",
"os.version": "10.0",
"user.language": "en",
"user.timezone": "Australia/Sydney"
},
"metabase-info": {
"databases": [
"h2",
"sqlserver"
],
"hosting-env": "unknown",
"application-database": "h2",
"application-database-details": {
"database": {
"name": "H2",
"version": "1.4.197 (2018-03-18)"
},
"jdbc-driver": {
"name": "H2 JDBC Driver",
"version": "1.4.197 (2018-03-18)"
}
},
"run-mode": "prod",
"version": {
"date": "2021-11-09",
"tag": "v0.41.2",
"branch": "release-x.41.x",
"hash": "ad599fd"
},
"settings": {
"report-timezone": "Australia/Victoria"
}
}
}

@amosm The recommendations about Java and H2 will not change anything about this. It's just recommendation for a healthier system.

You are showing the query browser, which will remove the field from the results if you exclude it there.

You can only do this by hiding the column, either via the dashboard card visualization options or by hiding the column via the Admin > Data Model:
https://www.metabase.com/docs/latest/administration-guide/03-metadata-editing.html#column-visibility

Hiding via Admin > Data Model didn't work. Have resorted to removing it via the Dashboard viewing option of the question. Thanks.

@amosm Did you set it to "Only in Detail Views" and then try to create a new question for that table? That should work. But if you manually add the column, then it overrides the original hiding.

@flamber had set to Detail View only and also Do not include - still does not work on a completely new question. It is currently an int field, but I also tried originally passing the URL via the SQL view, but that made no difference.

@amosm Okay, I guess you're doing something that I cannot reproduce. When using SQL, then the columns in the select-clause are always included in the results, so using the visualization settings will just hide the column.

1 Like