Best way to pass parameters to MDX query ? I am trying to figure out the multiple ways that could be used to handle different params.
You can use StrToMember or StrToValue.
Related
I want to know if it's possible to pass in a list as a parameter in native queries.
When search up online, an article in Baeldung has exactly what I want to do:
Collection-Valued Positional Parameters usage
I did the exact same thing, except that in the article, they used "createQuery" and I used "createNativeQuery". Not sure if this is the reason why mine is not working.
CreateQuery means JPQL was passed in which is parsed and modified into SQL, which allows it to break the collection parameter into its components to pass each into the SQL statement. CreateNativeQuery uses your SQL which isn't modified, and JDBC doesn't understand collections so requires parameters broken up into individual arguments in the SQL. You have to do it yourself and dynamically build the SQL based on the number of parameters in the collection.
There are other questions with solutions that touch on other options, such as using SQL within criteria or JPQL queries that can let you get the best of both.
As the title states, just wondering if it's possible to make reference to a value in the previous record in FetchXML? I can do this fairly easily in SQL (even without resorting to analytic function LAG) but as FetchXML doesn't allow subqueries, I'm not sure if it's possible to do this? Can anyone help?
Thanks
This is not possible with the current FetchXML specification.
I am really new to the hive space and am learning as we go. Anyway, currently I am using a SQL Server Table function that accepts several input parameters and returns a table of dates (invoicedate,duedate).
For example, i would pass in ('2017-01-01',12,30,3) (date, duration, terms,interval) and the output would be something like:
'2017-01-01','2017-02-01'
'2017-04-01','2017-05-01'
'2017-09-01','2017-10-01'
'2017-10-01','2018-01-01'
First, is this feasible to do within the hive environment? And second, if so, I'm thinking the UDTF would be the method. If anyone has any thoughts or can point me to an online example they have seen, i would be greatly appreciative.
What you want is a UDTF:
https://cwiki.apache.org/confluence/display/Hive/DeveloperGuide+UDTF
.................................
I need to make a query that makes a report using different tables, based on a value of one field.
This value affects the 'select' as well as the 'from' and 'where'.
At first I thought using dynamic SQL, but since the 'from' and 'where' are also changing it won't work.
Now I'm thinking about making views for all the different report types and I have 2 questions about is, since I'm pretty new with this:
how do I use the views in the main query?
is there a better idea that could work for the problem?
Thanks in advance
how do I use the views in the main query?
Just like every table.
is there a better idea that could work for the problem?
I don't know if it's better but you can use UNION (if number of columns in every report is equal and their types are the same).
I'm trying to get a list of Change Requests that match certain conditions, some of these conditions are met by using functions like has_attr().
I would like to ask is it at all possible, I need for instance to use such function has_associated_task(cvtype="task") is it possible to do that?
For queries I'm using the following pattern:
http://ip[:port]/change/oslc/db/dbURI/role/User/cr?oslc_cm.query=change:cvtype="problem" and request_type="Change_Request" and has_associated_task(cvtype="task")&oslc_cm.properties=problem_synopsis
this does work without the function term but I would like to extend the search criteria further, is there any other way besides doing a predefined query in change? Is there somewhere a list of terms? like change:cvtype (I've tried to see this [http://www.ibm.com/xmlns/prod/rational/change/1.0/][1] but I got a "whoops" from the web server)
There are some ways you could solve this:
OSLC Resource Shapes - some OSLC providers associate shapes (like schemas) that describe what you can expect from an OSLC Query Capability.
There isn't a way in the simple query syntax to test for null (or not null), assuming you want to have some condition such as (cvtype="task" and linkedTask != NULL). To get around this you can simply query based on cvtype="task" and locally filter the results using tools such as XPath or Jena. Alternatively you can do is look for extensions to the tool you are working with to see if they provide any extensions to the query syntax to support your use case, I don't have this information off hand.