How can I show only some attribute elements in GoodData filter dropdowns? - gooddata

I know metrics and useAvailable clause in dashboard filter definition can be used to limit what the user sees in the filter dropdown. How do I properly define the filtering metric and what should the filter definition look like?

filtering metric:
SELECT SUM (1) WHERE ATTRIBUTE IN (VALUE1,VALUE2,...,VALUE N)

Related

Ldap Group filter query to excluse nested group in member list

I want to write the ldap group filter where I want to pull all the groups and their members but exclude nested group member within specified OU.
It will remove the chance of cyclic group.
For example Group A contains following member:
user 1
user 2
Group 1
In the query I only want Group A with user 1 and user 2.
The filter example is (&(objectClass=Group)(member=*)) but I do not know what are the options I can use in the member filter.
If you want to retrieve the members of a certain group you would use a filter like (&(objectClass=groupOfNames)(cn=rdn-of-the-very-group)) and include memberin the list of attributes to retrieve. Without further assistance by an extended search control you only will get direct members, so no worries about members of nested groups. In order to eliminate nested groups from the search result, include objectClassin the attribute list. You'll have to filter on the client side, though.

Can a metric use multiple Variables in a dashboard?

Say there is metric that has records from multiple clients
select count(id) WHERE variable
Is there a way to have the metric use multiple variables which are defined in a dashboard? Something like
select count(id) WHERE variable_value1 OR variable_value1.
The metric would appear on a dashboard that has either variable_value1 or variable_value2. I've test using the OR logic, but the metric still shows data from both values instead filtering to whatever variable_value is on the dashboard.
I know a variable as a filter on the dashboard would do the same job, but users (that have unfiltered access to all variables values) want to have a fixed view per variable value in separate dashboard tabs and I'd like to avoid duplicating metrics for each variable value.
This is something that can be done within the metric, but it depends on the data that you are looking at. The metric itself would look something like this:
SELECT <metric> where <attribute> = <attribute_value1> AND <attribute> = <attribute_value2>
You can replace the "AND" with an "OR" within in the metric as well. If you need further clarification, could you please provide a specific example? We would be glad to help you out here.
Thanks,
GoodData Support

ElasticSearch Get Value of Nested Attribute

I have this structure in index:
{ details: {errors:[], warnings:[], results:[]}}
I want a query so that I can get the count of errors warnings and results for each record.
I was looking into the script filter on an aggregate, but the thing is I am already aggregating and I'm unsure on how to use the value count filter with this since I need to
1) Get the .length attribute of the array
2) When I do that I get an error saying no attribute like that exists
Can I get a sample query? I'm guessing it will somehow incorporate the script filter.
The best way to achieve this is the token count data type told in the below link
LINK - http://www.elastic.co/guide/en/elasticsearch/reference/1.4/mapping-core-types.html#token_count
You can couple this with multi fields to achieve an extra field per error , warning and results. This can be used in the query to view the count of elements.

Few questions about Grails' createCriteria

I read about createCriteria, and kind of interested on how these works, and its usability in providing values for dropdown box.
So say, i have a table in the database, Resource table, where i have defined the table in the domain class called Resource.groovy. Resource table has a total of 10 columns, where 5 of it are
Material Id
Material description
Resource
Resource Id
Product Code
So using the createCriteria, and i can use just like a query to return the items that i want to
def resList = Resource.createCriteria().list {
and {
eq('resource', resourceInstance)
ne('materialId', '-')
}
}
Where in the above, i want to get the data that matches the resource = resourceInstance, and none of the materialId is equal to '-'.
I want to use the returned data from createCriteria above on my form, where i want to use some of the column on my select dropdown. Below is the code i used for my select dropdown.
<g:select id="resourceId" name="resourceId"
from="${resList}"
disabled="${actionName != 'show' ? false : true}" />
How do i make it so that in a dropdown, it only shows the values taken from column Product Code? I believe the list created using createCriteria returns all 10 columns based on the createCriteria's specification. But i only want to use the Product Column values on my dropdown.
How do i customize the data if in one of the select dropdown in my form, i wanted to show the values as "Resource Id - Resource Description"? The values are combination of more than 1 columns for one select dropdown but i don't know how to combine both in a single select dropdown.
I read that hql and GORM query are better ways of fetching data from table than using createCriteria. Is this true?
Thanks
First of all refer to the document for using select in Grails. To answer all questions:
Yes, the list to select from in the dropdown can be customized. In this case it should be something like from="${resList*.productCode}"
Yes, this can be customized as well with something like
from="${resList.collect { \"${it.resourceId} - ${it.resourceDesc}\" } }"
It depends. If there are associations involved in a domain then using Criteria will lead to eager fetches which might not be required. But with HQL one gets the flexibility of tailoring the query as needed. With latest version of Grails those boundries are minimized a lot. Usage of DetachedCriteria, where queries etc are recommended whereever possible. So it is kind of mixing and matching to the scenario under consideration.

Get the Attributes filter by using its display name?

I am trying to desgin a MDX query with Date filter which is an hierarchy attribute.. Now, I need to place the attribute filter value in the "where" clause.. When I drag and drop the attribute say - '2012', it gets converted to someother format like '[Date].[Fiscal Hierarchy].[Year].&[2.012E9]' whereas in leftpane display it shows as 'YR 2012'..
How do I control this conversion ? I am not sure on what basis it converts this attribute like that ?..
I need to build the MDX query dynamically in program based on the user selection.. How do I determine it is '2.012E9' when the user selectes '2012'? Or is there any way to alter the filter condition in MDX so that I can acheive this without using [2.012E9] string ?
Thanks in advance..
SELECT
[Subjects].[Name] on Rows,
[Student].Name ON COLUMNS
FROM Cube
where
[Date].[Fiscal Hierarchy].[Season].&[**2.0121E9**]
-- But the left side pane(Cube browser) shows the attribute as 'YEAR 2012'
Each member has a unique name and a display name.
In the left pane you see the display name. In the Mdx query the key of the member is used (see MSDN).
If you want to change the unique names you have to change your keys.
I am able to do this by changing the query like this:
SELECT
[Subjects].[Name] on Rows,
[Student].Name ON COLUMNS
FROM Cube
where
[Date].[Fiscal Hierarchy].[Season].[YEAR 2012]