Using LOOKUPSET in Table object - ssrs-tablix

I have sets of parameters in tables using expression. Question? Can i use syntax LOOKUPSET inside the table expression? When i add a LOOKUPSET expression on some of my parameters, it doesn't show up. Is it only valid using text box?

Related

How to search for multiple values in a string column in a Cognos Oracle Query

I need to search an oracle table column for multiple word strings in cognos oracle query.
For example:
If Focus parameter returns multiple values as below
TRAINING
OMNIA
COUNTER
PROGRAM
And I need to search project.proj_name column like '%TRAINING%' or '%OMNIA%' or '%COUNTER%' or '%PROGRAM%'
I am trying below but I know it does only single value match not multiple. I want to know how to achieve multiple value match here.
'-99' in (#promptmany('Focus', 'string','-99')#) OR REGEXP_LIKE(proj_name, #promptmany('Focus', 'string','-99')#))
Working from Cognos Paul's solution to use output from promptmany as a table:
Assuming your query is named Q1...
Add a query. (Q2)
Add a SQL object to that query.
Set the Data source property for the SQL object.
Change the SQL Syntax property to IBM Cognos.
Define the query as
SELECT
parameterValue
FROM (VALUES
(#join('),(',split(',',promptmany('Scenarios','string',sq('N/A'))))#)
) query(parameterValue)
(change the names for your own use case)
Add a query. (Q3)
Add a join to the new query.
Add Q1 and Q2 to the empty boxes for the join leading to Q3.
Set the join as
[Q1].[proj_name] like '%' || [Q2].[parameterValue] || '%'
Add the required data items to Q3.
Since two keywords (from your parameter -> Q2) could be found in a single value (in Q1), you'll likely end up with duplicate rows. Cognos will probably handle this with its default aggregations, but keep a lookout.
Be careful with this. The new query (Q2) will probably be joined on the Cognos server, not on the database server. Be sure you have sufficient filters leading into this structure so Cognos is not trying to process your entire database.
This worked for me with SQL Server. I don't have an Oracle database to test against, but using IBM Cognos as the SQL Syntax should handle that.
To use REGEXP_LIKE to solve this problem, you'll need to get the second argument correct. I can't see any reason to see the error message ORA-00996: the concatenate operator is ||, not |, but I'm not working with your code in your system.
You don't specify which version of Cognos, or even which Cognos product, you are using. I'll assume Cognos Analytics 11.1.7.
To determine what Cognos Analytics is doing with your macro, create a very simple query with one item from the database (preferably from a very small table) and another data item that contains the macro. So the data item expression is:
#sq(join('|',split(',',promptmany('Focus','string','-99'))))#
When you run this, you may not be prompted. You'll see the value is -99. So to test this we'll need to remove the default so that the prompt becomes required.
#sq(join('|',split(',',promptmany('Focus','string'))))#
Be sure to enter more than one value when you test.
In my environment, the parameter returns a value that is my values surrounded by quotes (') and delimited by semicolons (;). So my tests produced the following:
expression
value
#sq(promptmany('Focus','string'))#
'PROGRAM';'COUNTER';'TRAINING'
#sq(join('|',split(',',promptmany('Focus','string'))))#
'PROGRAM';'COUNTER';'TRAINING'
#sq(join('|',split(';',promptmany('Focus','string'))))#
'PROGRAM'|'COUNTER'|'TRAINING'
replace(#sq(join('|',split(';',promptmany('Focus','string'))))#, '''', '')
PROGRAM|COUNTER|TRAINING
Your mileage may vary.
At this point, you know which macro to use in the REGEXP_LIKE function.

how to pass the parameter 08-2019 in birt report

how to pass the parameter 08-2019 in birt report I need to pass this month and year parameter which I marked
You do that with query parameters. You first need to exchange the date string in the query with questions marks (?). For your example, this will be 5 question marks.
Edit the Dataset, change the query, and then click Parameters on the left. Important: you need to add a parameter for each single question mark even if they all relate to the same value. Parameters will be added to your query in order of definition. If you have more or less parameters than question marks in your query, an exception will be raised. So keep these synchronized.
As you do have a specific date format, do use String as parameter type. You can use a report parameter as a reference and pass that string dynamically (which is most likely what you want).

Using variables in From part of a task flow source

Is there any way to use a variable in the from part (for example SELECT myColumn1 FROM ?) in a task flow - source without having to give the variable a valid default value first?
To be more exact in my situation it is so that I'm getting the tablenames out of a table and then use a control workflow to foreach over the list of tablenames and then call a workflow from within that then gets data from these tables each. In this workflow I have the before mentioned SELECT statement.
To get it to work properly I had to set the variable to a valid default value (on package level) as else I could not create the workflow itself (as the datasource couldn't be created as the select was invalid without the default value).
So my question here is: Is there any workaround possible in this case where I don't need a valid default value for the variable?
The datatables:
The different tables which are selected in the dataflow have the exact same tables in terms of columns (thus which columns, naming of columns and datatypes of columns). Only the data inside of them is different (thus its data for customer A, customer B,....).
You're in luck as this is a trivial thing to implement with SSIS.
The base problem for most people is that they come at SSIS like it's still DTS where you could do whatever you want inside a data flow. They threw out the extreme flexibility with DTS in favor of raw processing performance.
You cannot parameterize the table in a SQL statement. It's simply not allowed.
Instead, the approach that people take is to use Expressions. In your case, assuming you had two Variables of type String created, #[User::QualifiedTableName] and #[User::QuerySource]
Assume that [dbo].[spt_values] is assigned to QualifiedTableName. As you loop through the table names, you will assign the value into this variable.
The "trick" is to apply an expression to the #[User::QuerySource]. Make the expression
"SELECT T.* FROM " + #[User::QualifiedTableName] + " AS T;"
This allows you to change out your table name whenever the value of the other variable changes.
In your data flow, you will change your OLE DB Source to be driven by a query contained in a variable instead of the traditional table selection.
If you want an example of where I use QuerySource to drive a data flow, there's an example on mixing an integer and string in an ssis derived column
Create a second variable. Set its Expression to create the full
Select statement, using the value of the first variable.
In the Data Source, use "SQL command from variable" option for the
Data Access Mode property.
If you can, set a default value for the variable you created in step
That will make filling out the columns from your data source much easier.
If you can't use a default value for the variable, set the Data
Source's ValidateExternalMetadata property to False.
You may have to open the data source with the Advanced Editor and
create Output columns manually.

List table validation rules/checks in FoxPro

I need to check and see if a validation rule exists on a table and/or field in FoxPro (to determine programmatically if it should be replaced/added/removed). DISPLAY STRUCTURE doesn't include any validation rules.
Is there a VFP command to list out validation rules on a table (to an array, file, cursor, anything)?
I found that AFIELDS() and COPY STRUCTURE EXTENDED both include field and table validation rules.
For AFIELDS() the table expression is stored on the first row of the array in column 10, and the field validation expression is stored with each row in column 7.
For COPY STRUCTURE EXTENDED the table expression is in the first row in a memo column called table_rule and the field expression is stored with each rule in a memo column called field_rule.
You can use DBGETPROP to get information for a single DB-object/field:
? DBGETPROP("mytable.myfield","Field","RuleExpression")
or for a table:
? DBGETPROP("mytable", "Table", "RuleExpression")
Another option is to use the GenDBC utility that comes with VFP. It generates a program that recreates the database.

ReportViewer - how to filter on Multi Value Parameter

I have a report that uses a Multi Value parameter. I have added this to the report and can specify the parameter values in code.
Now I want to filter the data on the report by the multiple value parameter. Eg, I pass in a list of account no's and I want to filter the data on the report so only records with the passed in account no's are shown.
In the tablix properties there is a filters option which looks like the place I need to set up the filters.
I have added a new one, selected the Account Number column on the report. The operator that seems relevant to me is the 'in' operator. So show records that a 'in' this list. However, If i select the 'in' filter the expression text box is disabled. Is this what im meant to use?
Found it:
You should filter on The name of the parameter rather than an expression.
eg:
[#CostCentres]
rather than:
=Parameters!CostCentres.Value

Resources