Pentaho mondrian cube main sql query - pentaho

I had a problem while programming a schema in mondrian. The thing is that I want to filter the main query inside the tag of the cube so that it can only access the dimensions taking into account the logged in user. Is there any way to get that value dynamically and add it to the query?
<Cube>
<Annotations>
</Annotations>
<View>
<SQL dialect="generic">
<
select a.*
from xxxxx a where (here is where i want to obtain the username value)
>
</SQL>
</View>
I tried to search in several webpages but I didn't find anything

Related

Simple Query Help Using XRMToolbox

I am using XRMToolbox and its tool "Bulk Data Updater" with Microsoft Dynamics CRM. I need to update a boolean value of multiple accounts after searching for them by account number. I believe it requires some type of JOIN.
I believe I have constructed the proper query, but when I try to Bulk Update (see picture), the attribute of the boolean value I need is not listed in the dropdown menu.
When I run this query:
I get the results needed
I get the specific user_id values I need, and I get their status "approved" which is the boolean value I need to change, but I can not edit these values because "approved" attribute is not listed in the dropdown menu
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
<entity name="contact" >
<attribute name="user_id" />
<link-entity name="application" from="applicant" to="contactid" >
<attribute name="approved" />
<link-entity name="contact" from="contactid" to="applicant" >
<filter type="or" >
<condition attribute="user_id" operator="eq" value="0000021" />
<condition attribute="user_id" operator="eq" value="0000055" />
</filter>
</link-entity>
</link-entity>
</entity>
</fetch>
When you want to set fields on an account, you need to query accounts, but you query contacts.
You already chose the XrmToolBox plugin to use for bulk update, but the query is not the expected one to update back the results - i.e., you mentioned account but the query only has contact and application entities joined. So obviously the query is not composed from the right direction.
If you want to update the application entity, build the query in FetchXML builder starting from application entity rather than from related contact side.
Or you can build the Advanced find query to use, (or download the fetchxml from there or even save that Adv.find query as CRM view to use in Bulk Data updater) you can simply export/bulk edit the records in Excel online to save back. You can select 250 records at once to Bulk edit wizard or to run Workflow to update.
Every single approach need the parent entity list from query to update the field. Start over.

How to get list of DataTables metadata used in SSAS DSV?

I was wondering if there's a simple way to extract a list of all the tables description from the Data Source View at SSAS? I've been so far been playing around with this simple DMV-query to get the cube metadata:
SELECT * FROM $system.dbschema_tables
WHERE TABLE_TYPE = 'TABLE'
Which returns me a complete list of the tables but it's completely blank at DESCRIPTION despite the fact that I written in several of the DataTables Description field. Am I perhaps using the wrong rowset?
There is a workaround for the case if you are able to do it semi-manually:
You generates XMLA script for every SSAS Cube in the SSMS
Uses following XPATH query to collect the tables/views used in DSV of the cube: /Create/ObjectDefinition/Database/Cubes/Cube/Annotations/Annotation[]/Value/dds/ddscontrol[]/layoutobject/ddsxmlobj[not(boolean(./property[#name="Virtual"]))]/property[#name="LogicalObject"]/#value
P.S you can use websites like http://xpather.com to play around with the query on your XMLA
P.P.S result is returned in following format: <SchemaName>_<TableName>

How to Check Teradata Table Definitions

In my Teradata SQL Assistant Client, I can right-click a table and select Show Definition, this will display the column types and how they are defined.
Is there a query that can be run to give me the same output? More specifically I'm trying to display the definition of a view that is created from certain tables that I do not have SELECT or VIEW DEFINITION access to.
SHOW TABLE {Database_Name}.{Table_Name};
SHOW VIEW {Database_Name}.{View_Name};

Select query changing content order

I am using DB2 db, I have a table with one column containing xml, when I view the table in the data view of SQL Developer
<ns5:benefitComponent desc="Urgent Care Professional" level="2" name="UrgentCareProfessional">
now when i use a select query to fetch this, it changes to
<ns5:benefitComponent name="Acupuncture" level="1" desc="Acupuncture">
The order of the attributes changed am not sure why this happens, can anyone help me out?
DB2 stores an XML in a internal format, but it is stored according to the XML schema. Probably, your XML schema does not enforce an order. You should define the elements in a sequence in order to force the order.
http://www.w3schools.com/schema/el_sequence.asp

Create dynamic table from SQL Query

Using a hybrid Access 2010 / SQL Server 2012 platform - (a solution in either application will work)
I have a table created with a Select Into ... statement.
Is there any way to have this table dynamically update itself (using the query that created it) whenever its data is accessed?
Specifically, we want to keep a list of customers with only one order (non-repeat customers). I have created a table that contains the ID of those customers (WHERE COUNT(orderID) = 1) using Select Into, but if one of those customers makes a new order, or a new customer who makes one order is created, then I want that data removed/added to the table dynamically.
So, is this possible, or do I have to remember to update the table myself whenever I use it?
I have a table created with a Select Into ... statement. [...] Is there any way to have this table dynamically update itself (using the query that created it) whenever its data is accessed?
What you've described is a SQL VIEW, also called a "(saved) SELECT Query" in Access. A View is a virtual table that dynamically retrieves its information from other tables (or views) each time it is accessed. The view does not save its results between calls, so each time you reference it you get the most current data. See if you can use a VIEW (in SQL Server) or a saved SELECT Query (in Access) in place of the temporary table you are currently creating.