Hi, I’m running into issues while using AttributeF...
# gd-beginners
e
Hi, I’m running into issues while using AttributeFilter from GD.UI. On the webpage it shows “Error loading filter” and in the console I’m getting the error
TypeError: can't access property "meta", displayFormDetails is undefined
I had initially asked on the community forum where it was pointed out that the attribute I tried to use was a date, which is incompatible with AttributeFilter. Initially switching to a non-date attribute had worked but now I’m running into other non-date attributes that are throwing the same error. (Original forum post with a fuller stack trace and sample code: https://community.gooddata.com/gooddata-ui-60/gooddata-ui-attributefilter-throwing-error[…]-access-property-meta-displayformdetails-is-undefined-346) Edit: Oh never mind. It’s because I put the attribute id and not the display form id. Ok, follow-up question then. From the attributes in the Ldm how can I get the actual name of each one? Also how can I tell which are dates and which aren’t? Previously I was using the REST api to
/query/attributes
which would include tags that I could check for, but displayForms don’t seem to have any such metadata.
z
Hi Evan, if it is ok to use UI interface to find it out, you can try this resource:
Copy code
<https://secure.gooddata.com/labs/apps/ui-developer-toolkit/build/index.html#/metadata>
• just make sure to replace the hostname secure.gooddata.com with your own hostname. Then search for attributes, please let me know if that helped.
e
Was hoping for a more programmatic solution. I was able to leverage the
useBackend
hook and get the name metadata that way. For anyone Ctrl-F from the future the code looked like this:
Copy code
const gdBackend = useBackend();
const gdAttributesAPI = gdBackend.workspace(workspace).attributes();
gdAttributesAPI.getAttribute(attributeFromLdm.attribute.displayForm);
Still haven’t found an easy way to get tags other than doing another query on the attribute itself after getting it’s uri from the displayForm metadata. Alternatively, instead of using the Ldm I can use the all attributes query (
/gdc/md/mi3l622mq24o9wbj20d3y7ybh96wbkfs/query/attributes
) and then query again now that I have the attribute ids. This seems unnecessarily complicated. What are the best practices around using AttributeFilters? For context what I’m trying to accomplish is to be able to add filters for any attribute I want so they could be applied to a set of insights.