IBM Cognos Report Studio: Expression Builder Syntax - cognos

I am working with Report Studio and need to create a few expressions for a cross-tab query. I am attempting to group orders into age groups (for the rows in the cross-tab). To build these groups I am trying to create an expression like the following:
select [SQL5].[OUTBOUND_ORDER_ID], [SQL5].[PRIORITY]
where [SQL5].[OUTBOUND_ORDER_LINE_ID] =1 AND [SQL5].[AGE] <= 2
Although this works in most SQL platforms, cognos is not validating the expression. While IBM has a lot of material for calculations, I have been unable to locate any with syntax examples. Can someone who is experience in Report Studio provide a syntax example to perform an expression such as the above? Thanks in advance.

What's the validation error you get? It appears you forgot the FROM part
select [SQL5].[OUTBOUND_ORDER_ID], [SQL5].[PRIORITY]
from [SQL5]
where [SQL5].[OUTBOUND_ORDER_LINE_ID] =1 AND [SQL5].[AGE] <= 2

Related

Tabular Cube - Excel Filtering Doesn't Function At Node Level

I have the issue described in this post. I have two cubes with the same data backing them, one a Multi-Dimensional cube, the second a Tabular cube. If I connect to the cubes with excel and drag the top level of a hierarchy(in this example "Company" into my filter category in the Multi-Dimensional cube, then enter some text in the search bar in excel:
(Hierarchy - In Excel)
(Hierarchy - In Visual Studio)
(MultiDimensional - In Excel as a filter)
The level below will be filtered by the text and the results will be returned. However if I filter the same hierarchy in the tabular cube, the results are different:
(Tabular - In Excel as a filter)
I receive no results, the search doesn't appear to function correctly. I can get it to work if I'm looking at the leaf level of the hierarchy, but it appears as though the node level of the hierarchy search feature for tabular cubes in excel doesn't work.
Has anyone else experienced this issue before, I'd love to post the model of the cube but it's rather proprietary, I have experienced the same issue in multiple types of proprietary cubes on multiple servers and clients. Is this some sort of configuration in the model I can change? Or something in excel I can change?
Update 1
I've been doing a bit more digging, I setup SQL Profiler to run against my SSAS server while I performed the search, seems it's generating a MDX query(this time on my "item" hierarchy):
WITH MEMBER [Measures].cChildren As 'AddCalculatedMembers([Item].[I1 - Category].currentmember.children).count'
Set FilteredMembers As 'Head (Filter(AddCalculatedMembers([Item].[I1 - Category].[Category].Members), InStr(1, [Item].[I1 - Category].currentmember.member_caption, "Per")>0),10001)'
Select {[Measures].cChildren} on ROWS,
Hierarchize(Generate(FilteredMembers, Ascendants([Item].[I1 - Category].currentmember))) DIMENSION PROPERTIES PARENT_UNIQUE_NAME,
MEMBER_TYPE ON COLUMNS FROM [XXX_Test_TabularPro]
But it appears to be erroring out (would explain why I'm not getting any results in excel) when run against my cube:
Either you do not have permission to access the specified member, or
the specified member does not exist.
It's a interesting error message, I've actually never seen it before, and there's not much on the internet about it, just a few dead ends. I'm quite sure I don't have a permission issue, I can reproduce the error by running the query as an admin on that server. I think it's related to something in the query or the format of the cube but I'm not quite sure which is the issue, and I'm not super familiar with MDX. Has anybody seen this before? Is there something I can change with the cube to not have this occur? Is it a syntax issue with the query, if so why would excel generate an invalid query?
Another interesting item of note, I noticed that the search function for a leaf level hierarchy works in excel(as noted above) so I swapped out "I1 - Item Category" for "IA - Item Name" and the query runs without issue (of course we're now searching the leaf level), it's something about running this query on a non-leaf level in this case "I1 - Item Category" that is causing this error to occur.
Update 2
Ok I've made a bit of a breakthrough, I've altered my query to see if any combination of input would allow it to work, and I've found one, if I change my filter from "Per" to "GL" I get a result, it turns out that the query outlined above is actually NOT returning results from "I1 - Item Category", it's actually returning results from "[Item].[IA - Item Name].Members" which contains a distinct list of item name's.
I can actually demonstrate this in excel as well:
This makes no sense what so ever, nowhere in my query shown above(the query generated from excels search) do I mention the item name, and you clearly see what "[Item].[I1 - Category].[Category].Members" should be returning in the screenshots above(and what is returned by the multidimensional cube), it just doesn't in tabular, worst of all I captured(with SQL profiler) the query from excel on searching the item hierarchy of both my identical tabular and multidimensional versions of my cube and they generate the same exact MDX query with the only difference being the name of the cube.
I'm forced to come to the conclusion that if one generates two identical cubes(identical as possible), one being tabular, the other multidimensional, and run the above query on them(assuming this hierarchy exists), they return different results, and tabular one will return incorrect results.
Has anyone seen this issue before? I feel the tabular cube is returning a incorrect record set for the specified MDX, how would this occur, is there anything I could do to modify the query or cube to resolve this issue?
Update 3
The saga continues, one of the core questions I'd like to answer here is: Is this something specific to the cubes I generate, or does it affect all cubes, I believe I have the answer to this...
Steps To Reproduce:
Open Visual Studio, New Project, Select "Analysis Services Tabular Project", Next, Create, (A popup will display "Tabular Model Designer" I selected "Workspace Server" point it at my tabular cube server and set compatibility model 1200)
Add the following data to a CSV file or by putting it in a SQL table:
Category_Description Sub Category_Description LeafName
Professional 10 Series Filter
Performance 10 TTR GL
Professional 10 Series Series 1
Unassigned Unassigned AUTOMOTIVE
Performance 500 S RACING
Right click on "Data Sources" select "Import from Data Source", navigate through the menus to import the data source defined above.
As part of item 3 you should've imported the table listed in step 2, you should see this in your tables the new table from your data source:
Open your new table and create the following hierarchy:
Right click on your "TabularProject" in VS, select "Analyze in Excel", this should bring up a excel window
Pull the "Hierarchy1" hierarchy into "Filters", drop down this hierarchy in excel and attempt to search for "Per": You'll see that no results are displayed.
IMPORTANT Note: If I change the workspace to "Integrated", rebuild and process the cube, I no longer see the bug, it must be related to how the server is processing this model, in someway it must be different then how VS does it locally.
Ok, I think I finally understand what is occurring here, I checked my SSAS version number:
15.0.32.55
This is quite old, so I updated to "15.0.35.15" and it appears as though the issue is now resolved(search in excel now works), I believe this version upgrade introduced a fix that resolves this bug, most likely either this one, or this one.
I tested this with a slightly different environment. I used Power BI to build the model and there, it works like a charm.
I uploaded the model then to SSAS and tested again and it still works out for me. I am SQL 2019 an Power BI.
Finally, I tested with VS 2019 native developed model and workspace server. Also, this works out without any problem.

Query from Kusto to PowerBI

there are 2 different experiences i have seen while using "Query to PowerBI" from tools menu in kusto explorer. image of both
I am getting the fist one, but want to use second one(query? with additional details/options). How do i get it in second format
You can control the behavior of PowerBI query using Tools->Options->Tools->PowerBI Export To Native Connector.

cognos report studio adds detail filters to new select

I have a Cognos (10.1) report with SQL. (at this moment we do not use packages)
The report has several optional prompts. The problem that I have is that Cognos doesn't add the WHERE clause straight to my SQL, but does this.
select * from (select my SQL) where
This means that it starts with collecting all the data and then filters it. Usually this isn't a problem, but my current SQL has a lot of joins on big tables so it is incredibly slow.
Is there a way to force Cognos to just add my filters to a where clause without an extra select statement?
select * from my SQL where
This would make my report a lot faster.
Try to include your prompt in your SQL using macros #prompt # and #promptmany #. Don't forget to set default values to make in optional.
P.S. Try to avoid direct SQL usage in Cognos reports.

hybris FlexibleSearchService can't find a product that actually exists

I'm trying to add a product to my cart, like this:
cartFacade.addToCart("M300044", 2);
And it fails with: Product with code 'M300044' not found!
When I debug the code, I find that this query is executed by FlexibleSearchService.search(query):
SELECT {c:pk} FROM {Product AS c} WHERE {c:code}='M300044'
If I execute this query on my hybris Admin console, I do get a Product as a result.
Why can't FlexibleSearchService find it though? Is it something to do with setting a catalog version somewhere?
In this case it was because I was doing this from a Test class, so hybris couldnĀ“t find the product because there was no data whatsoever in the junit tenant.
So I had to create the data in the setup method of my Test class, which is executed before the actual test method is called.
You need to make sure one more thing that you have set the session user = admin , because if there is a restriction applied on u r product then your test case won't work
I believe this is a SYNCHRONIZATION issue.
STAGED Product Version is not aligned with Online.
You have two options.
HMC > System > Facet Search > indexer wizard.
Product Cockpit.
Check available stock for product in hmc. May this help you
initialize Junit tenant so by checking import sample data yes so that data which you have in production will be available for testing.
you need to make full SOLR indexing for the products from hmc before they can appear in front end store or using hypris APIs
hope that help

Add a field to a query where the data comes from a subform

I need to filter a a table with parameters that are calculated on a non related table, but to do this in Access web I need to add the [Project_Id] to the task list.
To clarify further, the user answers some questions regarding the details of a project, which in turn will calculate in the background a group of parameters that are needed to sort a task list.
The problem is the task list is generic and not related to a project so before I can use the project related filter parameters I need to assign a project id to the task list or there is no relationship and no way of knowing what project parameters to use.
I tried to do this with a query but being a Web database I am unable to select the data from the form control.
Hopefully someone can help me find a solution, because I have exhausted Google and my own knowledge on the subject. One last thing I am unable to use code thanks to security issues.
In case anyone is interested I found away to assign the project id to the task list using data macros.
The data macro is assigned to a table that is related to the project and when updated edits the tasks list to add the current project id for each record in the table.
I still have some issues to work around, but in general it does what I need.

Resources