Hi Good Data, I am trying to get the label for a ...
# gooddata-ui
j
Hi Good Data, I am trying to get the label for a filter, but this is what's happening: the field is called "1-to-1 Created at" but it seems it gets truncated to
-to-1createdat
this way we couldn't get the correct name to display in the filter. BUT I am curious how you EDITOR gets the correct name when rendering the filter? 🤔 Given in the API I only get
-to-1createdat
({*"*id*"*=>*"*-to-1createdat*"*, *"*type*"*=>*"*dataset*"*}). so my question is basically if there is a way to get the correct text for the filters? Which in this case should be:
"1-to-1 Created at"
j
Hi Jhonatan, I’d be happy to double-check this for you. However, I’m a bit confused about what exactly you are reporting. Could you please confirm which API you are using? Also, you mentioned retrieving a label for a filter, but in your screenshot, I see a Date dataset setting. Could you clarify how this relates to your issue? Feel free to describe the steps you’ve don here. Thanks!
j
Hi Julius, the image is for demonstration only, I am using the endpoint to fetch a visuationObject in the filters attribute I get this: [{*"*relativeDateFilter*"*=> {*"*dataSet*"*=>{*"*identifier*"*=>{*"*id*"*=>*"*-to-1createdat*"*, *"*type*"*=>*"*dataset*"*}}, *"*granularity*"*=>*"*GDC.time.year*"*}}] but in GD editor the text looks perfect as in this other image. I wanted to know if there is a way for me to get the full text: "1-to-1 Created At"
so far I didn't find a way via the API to get the full text, I only get this as the ID
*"*-to-1createdat*"*
j
Got it! Thanks. Let me double-check on that. For some reason, it looks like it always cuts anything before the first dash. For example if you put there
5-5
you will only get
-5
j
I see, yeah I'll try without the dash to see how it goes
j
Actually, it looks that our naming convention always removes the leading number… The dashes don’t matter…
the identifier should start with letter or
_
The reason why you might see it differently across the platform is that the value is sometimes taken from the title. But if it’s taken from ID, it will get truncated.
j
it's just interesting that somehow GD editor picks up the correct naming, no matter what's the ID, but that name doesn't seem to be exposed in the API
j
correct, because it’s taken from title instead
which is 1-to-1 Created at in your case
j
but there really isn't a way to expose that in the API? we rebuild the filters on our side, so that would really help
j
I presume you are referring to this inconsistency is that correct?
Copy code
{
  "filters": [
    {
      "relativeDateFilter": {
        "dataSet": {
          "identifier": {
            "id": "test-123",
            "type": "dataset"
          }
        }
      }
    }
  ]
}
vs
Unfortunately, looks like it’s not visible in the visualization object metadata, because it takes the dataset ID from the the date dataset. I will double-check internally whether this is an expected behaviour.
j
yes, indeed, I would expect there would be something like: "identifier":{ "id":"test-123", "type":"dataset", "description": "Full field description" }
j
Hi Jhonatan, I was consulting this with our engineers and I can indeed confirm that this is an expected behaviour and that it’s a common practise that SQL identifiers and key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore (_). Example documentation which explains can be found here: https://www.postgresql.org/docs/current/sql-syntax-lexical.html
Therefore, we recommend not to name any datasets this way. I’m sorry if this was not the answer you were hoping for.
m
Hi Jhonatan, we’re just wondering if you've had a chance to review my colleague's latest update about filter/labels naming. As my colleague pointed out, unfortunately this is an expected behaviour when you naming in PostgreSQL, key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore ()_ . Please let us know if you still need any further assistance.