We're on <GoodData.CN> 3.21. I'd like to use the P...
# gooddata-cn
p
We're on GoodData.CN 3.21. I'd like to use the POST /actions/workspaces/{workspaceId}/execution/collectLabelElements endpoint to return a list of labels that start with a certain letter. For example, if I call this endpoint with the body {"label":"Account_Id","patternFilter":"X"}, it returns all labels with the letter 'X' anywhere in the string. How can I call this endpoint to return only labels that start with the letter 'X'? I noticed that passing "patternFilter" puts ILIKE '%X%' in the query. I'd like an option that puts ILIKE 'X%' in the query (so 'X' is at the start of the matched strings instead of anywhere in the string).
m
Hi Pete, Thank you for reach out to us, I would like to ask whether you can share with us the complete payload that you are using. Feel free to us DM.
p
Hi Maruicio, sure. Here is the full payload:
Copy code
{
  "label": "Source_Account_Id_",
  "patternFilter": "X"
}
This gets translated to ILIKE '%X%' in SQL. But we'd like to be able to do something like this:
Copy code
{
  "label": "Source_Account_Id_",
  "patternFilter": "X%"
}
This is so that "X" would be matched as the first character in the SQL statement. Let me know if you need anything else.
@Mauricio Cabezas Is there any update on what our options are?
m
Hi Pete, thank you for your answer, but just to confirm, this is the complete Payload? I would expect a payload like this:
Copy code
{
  "cacheId": "string",
  "complementFilter": false,
  "dataSamplingPercentage": 100,
  "dependsOn": [
    {
      "complementFilter": false,
      "label": "string",
      "values": [
        "string"
      ]
    }
  ],
  "exactFilter": [
    "string"
  ],
  "excludePrimaryLabel": false,
  "filterBy": {
    "labelType": "PRIMARY"
  },
  "label": "label_id",
  "patternFilter": "string",
  "sortOrder": "ASC",
  "validateBy": [
    {
      "id": "string",
      "type": "string"
    }
  ]
}
Which you can see in our API documentation , specifically check the body parameter
complementFilter
, please note this value is inverse.
p
Hi Mauricio, since we've been using this API for quite some time, I can confirm that the full payload is not necessary to invoke this endpoint. We are calling the API in our production services with just the "label" property. But due to the large number of labels for a particular use case, we'd like to filter on the first letter of some attributes.
m
Hi Pete, thank you for your patience. Still we are working on it. But, I would like to ask, what is the use-case for this? Using a MAQL does not works for you? same with a sql statement?