Set SQL value in Meta field of a Dimension
- Dominant language
- Rust
- Stars
- 20.8k
- Forks
- 2.1k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 181
Description
**Is your feature request related to a problem? Please describe.**
I'd like to be able to display a link on the frontend of my application with the text being the name of the data I'm linking. For example I want to link to a resource like `{nameOfResource}`. This would be much easier if I could fetch both the name and the link at the same time as a singular dimension, rather than having to combine them on the front end.
**Describe the solution you'd like**
I'd like something like this:
```
link: {
sql: `CONCAT('http://www.example.com/',${CUBE.id},'/')`,
type: `string`,
format: `link`,
meta: {
name: {
sql: `${CUBE.name}`
}
}
}
```
Or something similar. Basically here I want to fetch both the name and the link for the name at the same time.
**Describe alternatives you've considered**
Currently as a work around, I have to query for both `CUBE.name` and `CUBE.link` and then write some glue code on the front end to turn them into 1 dimension to render. This is okay, but definitely not ideal. Currently, with the existing link API you can only set static text for the dimension like in this example:
```
crmLink: {
sql: `'https://na1.salesforce.com/' || id`,
type: `string`,
format: {
label: `View in Salesforce`,
type: `link`,
},
},
```
But imagine you had tens or hundreds of links for various CRM entries, you wouldn't want to display `View in Salesforce` for ALL of them. You'd want an easier way to distinguish which one you're going to click.
Contributor guide
Assessment
This issue has not been assessed yet.