Use one value of multi value parameter in dataset query
I have a parameter @Period that is populated with posting periods from our financial system (e.g. 201301, 201302, 201303, etc.). It is set as a multi value parameter to allow users to choose multiple posting periods. This parameter
is used in my main dataset. If the user chooses 201301 and 201302, I want to choose the greatest value chosen and use it in a where clause such that MyPostPeriod <= @Period. Since @Period is a multivalue, the ><= won't work.
I read that SSRS just passes this as a comma separated value (201301,201302). How do I find the greatest value in the list and how do I use that in my where clause?
the user is selecting projects with activity during the posting period but then I want to grab all costs and invoices since the project was created. They choose to see activity in 201301 and 201302 but I need to get all invoices and costs <= 201302.
The only option I have been able to come up with is to have two parameters - one for start period and one for end period. Any better solutions? I'm not using stored procedures.
Milissa Hartwell
Hi Milissa,
Based on your description, you want to get the Maximum value from a multi-value parameter. We can insert the selected values into a temp table and get the Maximum values. Suppose we have main dataset (DataSet1) include Period field, and a parameter Period
in the report. Please refer to the following steps:
Create another dataset named DataSet2 using the query below.
CREATE TABLE #Max (COL1 INT)
INSERT INTO #Max Values(1)
SELECT * FROM #Max
Double click DataSet2, change the dataset using the expression below:
="CREATE TABLE #Max (COL1 INT)" &
"INSERT INTO #Max VALUES (" & Join(Parameters! Period.Value,"),(") &")" &
"SELECT TOP 1 * FROM #Max ORDER BY COL1 DESC"
Create a parameter (Max) set the Data Type to “Integer”, and get the available values and default values from the DataSet2 COL1. Then, set the visibility to “Hidden”.
Double click the DataSet1, click Filters in the left pane. Fill with following values:
Expression: [Period]
Operator: <=
Value: [@Max]
Please refer to the following screenshot:
Regards,
Alisa Tang
Alisa Tang
TechNet Community Support
Similar Messages
-
Passing value to multi value parameter from SSIS using Report server webservice
Hi
I am triggering SSRS report from SSIS(Script task). I am passing parameter values from SSIS package.
So far working fine. Now, I have a report which has 2 parameters. One is single value parameter and the other is multi value parameter.
No issue assigning value to single value parameter. But how can I pass multi value to multi value parameter?
My code as below
ReportExecutionService rs = new ReportExecutionService()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
rs.Url = _webserviceURL;
rs.LoadReport(_reportPath, null);
ParameterValue[] paramval = new ParameterValue[2];
paramval[0] = new ParameterValue();
paramval[0].Name = "CountryCode";
paramval[0].Value = _countryNames;
**paramval[1] = new ParameterValue();
paramval[1].Name = "BusinessCode";
paramval[1].Value = _businessCode;****
rs.SetExecutionParameters(paramval, "en-us");
I am not sure how to pass value to BusinessCode(Multi value parameter)Hi Rajkm,
In order to pass a multi-value parameter through the Reporting Services Web services, you need to define the same numbers of ParameterValue objects as the number of the values of the multi-value parameter being past into the report. The Name property
of these ParameterValue objects must be specified same to the parameter name.
I found a good FAQ article for this scenario:
How do I pass a multi-value parameter into a report with Reporting Services Web service API?:
http://blogs.msdn.com/b/sqlforum/archive/2010/12/21/faq-how-do-i-pass-a-multi-value-parameter-into-a-report-with-sql-server-reporting-services-ssrs-web-services-api.aspx
Hope this helps.
Elvis Long
TechNet Community Support -
Can i use one JSF component's value for other component in the same page.
Can i use one JSF component's value for other component in the same page.
For example
I have a <h:selectBooleanCheckbox id="myChk"> in my jsf page, i want to access its value for another component like:
<h:commandButton disabled="#{myChk.checked}" action="myAction" value="myValue" />
** "myChk.checked" >> I am just asuming "checked" property is available...Bind the checkbox to a UIInput myChk property. Then you can reference this property from the page, e.g.
<h:selectBooleanCheckbox binding="#{myBean.myChk}" onchange="submit();" />
<h:commandButton disabled="#{myBean.myChk.value}" action="myAction" value="myValue" /> -
Using Calculated Field in Multi Value Field
In Siebel Application
Sales Order---> List
There is a field call "Sales Rep" which displays an "USERID" of Order Sales Team Mvg Applet.
But We want to display the Last Name and First Name (combined).We got the first and last name using calculated field (Active Full name).
When I try to get the full name, the system display the name based on the "Primary position", if I step out of the particular row and come back again
Is there any way to display the full name without step out any rows for Sales Rep fieldYour description is a little confusing. For performance reasons it is always best to set the use primary join on multi value links. This means that when multi value fields are displayed in applets they always show the primary by default. If you want to display something other than the primary what is your rational behind this and why not make the record you want to display the primary?
Message was edited by:
Richard@AXA -
Show selected value from multi-selected parameter in crystal report
Dear Experts!
i would like to ask how to catch selected value from multi-selected parameter to show in report header section.
Thanks in advance.Hi Dara,
If this is a string prompt then you could simply create a formula with this code and place it on the report header:
Join({?Prompt name},", ")
-Abhilash -
Single-valued or multi-valued?
Please knidly help to explain, in which case the filed should be single-valued, or multi-valued?
Hi Alfred
Say you're storing employee information in MDM, and the employee data structure includes a "Country of Birth" field, and a "Nationality" field.
You can only be born in 1 country, so this field would be single-valued.
However, you can have multiple nationalities, so this field would be multi-valued.
Similarly, an employee could have "Preferred language" and "Spoken languages" fields. The "Preferred language" field would be single valued, while the "Spoken languages" field would be multi-valued. Both fields will lookup to the same table (Languages).
HTH
Mark -
Retrieving empty values from multi value string in user profile custom properties
Hi,
I created a webpart to save and retrieve data from custom properties. I use the code below to get the stored data:
for (int i = 0; i < profile[property].Count; i++)
Item = profile[property][i] == null ? string.Empty : profile[property][i].ToString();
list.Add(Regex.Split(Item, @"\,\#"));
Nothinig special about it.
In my development environment, it works fine. The problem is in my UAT environment. I'm facing an issue that i hope someone has been through. When the custom property is a multi value string type, it returns a empty string. I tested with HTML and single
value fields and it works fine.
Independently of the field type, it saves the data all right.
Can anyone help me?
Thanks!!Thanks, Chitvan Jain.
I did as you suggested, but nothing changed. The problem is that profile[propname] comes already blank when using multi value property, even if there is data to be retrieved.
One funny thing is that, somehow the code manages to count the number of values there is in the property. Only the data is missing. We can see the exact number of column, cause i check if there's the right number of data, if there isn't, i add up a empty
string on the grid cell, but only for viewing. The empty string is not stored in the property. -
SSRS : Reporting Services - Multi-Value Parameter Issue
Hi,
This problem is been around the blogs and forums for while now but may be it's not answered to the fullest. I couldn't get any satisfactory or completed solution on the issue so far, any clues/help will be highly appreciated.
My scenario is very simple :-
I am using SQL Server 2005 and SSRS. I need to develop a report which has a parameter value called Customer Name. The users should be able to select multiple customers from the list and sometimes Select All also. I tried the following :-
Created two data sets : Second dataset is just to populate the Customer Name
Created a Report Parameter and mapped with the query parameter where it says "Where CName in (@Parameter1)"
Nothing seems to be working although I tried to apply all the existing half-way solutions currently available in the forums. May be I am not getting to the right solution.
Here is what's happening :-
When used '?' like "where CName = ?" then it's working fine for the single value. {Multi value query cannot be used with ?}
But for multiple values when used @Parameter1 like "where CName in (@Parameter1)" it's giving the following error
Cannot add multi value query parameter '@Parameter1' for data set 'Dataset1' because it is not supported by the data extension.
However if commented this line it's pulling all the values whether or not selected from the parameter list.
This is the basic thing which I was not able to get the desired result, in addition I was looking to get the Customer Name parameter selected with a partial entry as we use LIKE. Example :- If the user enters 'St' in the text box the list should show all the names starting from those two letters
Starter
Steve
Steven
Stevenson etc.
I am not sure whether I'll will be able to get to this extent or not but until the multi value parameter, I am desperate to get the solution. So any sort of help/advise is highly appreciated.
Regards,Hi,
This problem is been around the blogs and forums for while now but may be it's not answered to the fullest. I couldn't get any satisfactory or completed solution on the issue so far, any clues/help will be highly appreciated.
My scenario is very simple :-
I am using SQL Server 2005 and SSRS. I need to develop a report which has a parameter value called Customer Name. The users should be able to select multiple customers from the list and sometimes Select All also. I tried the following :-
Created two data sets : Second dataset is just to populate the Customer Name
Created a Report Parameter and mapped with the query parameter where it says "Where CName in (@Parameter1)"
Nothing seems to be working although I tried to apply all the existing half-way solutions currently available in the forums. May be I am not getting to the right solution.
Here is what's happening :-
When used '?' like "where CName = ?" then it's working fine for the single value. {Multi value query cannot be used with ?}
But for multiple values when used @Parameter1 like "where CName in (@Parameter1)" it's giving the following error
Cannot add multi value query parameter '@Parameter1' for data set 'Dataset1' because it is not supported by the data extension.
However if commented this line it's pulling all the values whether or not selected from the parameter list.
This is the basic thing which I was not able to get the desired result, in addition I was looking to get the Customer Name parameter selected with a partial entry as we use LIKE. Example :- If the user enters 'St' in the text box the list should show all the names starting from those two letters
Starter
Steve
Steven
Stevenson etc.
I am not sure whether I'll will be able to get to this extent or not but until the multi value parameter, I am desperate to get the solution. So any sort of help/advise is highly appreciated.
Regards,
you speak spanish -
Download/Upload Multi-valued property using Code
We are developing program that will download document properties from one Portal Server and upload document properties to another server.
Can someone provide a code snipplet on how to deal with multi-valued property for this download/upload requirement.
1. How do we download property values for Multi-valued properties for document.
2. How do we upload property values for Multi-valued properties for document.We were able to do this. This bug is fixed by SAP in 7.0 ICE.
-
In Report Builder 3.0, I have made a main report in which the user can filter the underlying dataset using three parameters (all multi-value). The report shows totals grouped by these three parameters, as well as a grand total. What I want is to click
on a total, which then opens the drill-through report for the corresponding records. I have achieved this for the grand total; the action in the corresponding text box passes all selected values of the parameters to the drill-through report.
What I cannot figure out is how to make this work right when clicking on a subtotal. When I use the same expression as for the grand total, the same values for the parameters are passed, instead of the subset that apply to the corresponding text box in the
main report. I expected this to work, because Report Builder /does/ correctly calculate the SUMs for the different levels, even though the expressions are the same.
My question is: how do I pass different drill-through (multi-) values for parameters, corresponding to the respective subtotals in the main report?
(FYI: I am using Microsoft SQL Server 2008 R2 and Report Builder 3.0 .)Hello Katherine,
Thanks once more for your quick reply.
I was aware of the textbox action "Go to report", and how to pass parameters in general. My question concerned how to determine the scope of the passed multi-value parameters (to the values that apply to the respective group/subtotal). The article you linked
to is informative, but not a solution to my problem.
A colleague of mine came up with a pragmatic solution: instead of trying to determine the scope of the parameter values, now I "look to the left in the results table". The two screenshots below should illustrate this. (Screenshots are in Dutch. Specific information
is pixelated.)
Unfortunately, I am not able to post images. Once my account is verified, I will edit them in. For now, I hope the text speaks for itself enough.
[Screenshot: Drill-through parameters - 01: Report Builder tablix with subtotals]
[Screenshot: Drill-through parameters - 02: Textbox properties (selected in screenshot 01) - Action - Go to report]
The first screenshot shows the tablix in the Report Builder. The second screenshot shows the properties of the textbox selected in the first.
Notice that I do not pass parameters for the first two columns, but the actual values. I only pass the parameter (containing /all/ user-selected values) for the third column. In the textbox below the selected one, I pass the actual values for the first column,
and parameters for the last two. In the textbox above the selected one, I pass the actual values for all three columns.
The only (cosmetic) flaw this approach has is that in the drill-through report, the list of selected parameters might show values that do not occur in the (corresponding part of the) results, and only for those parameters for which the main report passes (all
user-selected) parameter values, and not the actual values in the results. The results are correct, though.
If there is a way to directly determine the scope of multi-value parameters for passing to a drill-through report, I would still like know. But for now, this seems to work. -
Passing single/multiple values to stored proc parameter from crystal report
I tried below solution posted on this forum to pass either a single value or multi-value to a sql server stored procedure parameter (varchar datatype) from crystal report XI R2.
In my crystal report , I am displaying all the available parameter values to the user and the user will select either a single value or multi value.
This worked when I select single value and when I say show sql query in my subreport I see the following:
{CALL "XYZ"."dbo"."storedprocedurename";1('Product 1')}
But this did not worked when I selected multiple values and when I say show sql query in my subreport I see the following:
{CALL "XYZ"."dbo"."storedprocedurename";1('Product 1,Product 2')}
I think it might work if it is as below:*
For multiple values:
{CALL "xyz"."dbo"."storedprocedurename";1('Product 1', 'Product 2')}
Please advise.
Solution Posted on this forum is as follows:
Hi,
As you must be aware of that a crystal report created of a stored procedure will allow only a single value for inserting a multiple value as a parameter in your report and pass those values to your stored procedure please follow the below work around which will be helpful for you.
Symptom
In Crystal Reports, you want to pass a multi-value parameter to a stored procedure. The problem with doing so is that Crystal Reports considers the multi-value parameter to be an array.
How can you pass a multi-value parameter to a stored procedure?
Resolution
Here are the steps to pass a multi-value parameter to a stored procedure:
1. Create a Crystal report, and add a multi-value parameter.
2. Since the multi-value parameter is treated as an array, create a formula that uses the JOIN function. Create a formula as below:
//Formula: @JoinFormula
Join ({?Multi-value parameter array},";")
====================
NOTE:
In the formula above, a semi-colon (";") is the delimiter.
====================
3. Within the main report, create a subreport based on the stored procedure, and include the parameter to be populated with the multi-value list.
4. Link the Join formula in the main report to the stored procedure parameter in the subreport.
Doing so passes a multi-value parameter to the stored procedure.
Regards,
VinayHi Vinay,
First you need to make sure the stored procedure accepts multiple values in the fashion 'a','b','c'.
Then, create this formula in the Main Report:
numbervar i;
stringvar s;
for i:= 1 to ubound({?Parameter}) do
s := s + "'" + {?Parameter}<i> + "'" + ",";
left(s,len(s)-1);
Link this formula to the sub-report's parameter.
Hope this helps!
-Abhilash -
How to create a multi value property
Hello,
I've defined a new property to use with the FAQ form, and set it to a multi value enabled (Multi-Valued checkbox on, Property Renderer set to multivalued).
I've added a new Combo Box object to the form using Form Builder, and assign the property to it.
However, I'm able to choose only one value while creating a new FAQ.
What should I do in order to make it a multi value selection box (without programming) ?
Thanks
EliHi,
You have to use the PortalApp.xml file
In that file you have to create the properties and can have n options, it will not require programming.
<?xml version="1.0" encoding="utf-8"?>
<application>
<application-config/>
<components>
<component name="Welcome">
<component-config>
<property name="ClassName" value="com.sap.tutorial.Welcome.Welcome"/>
</component-config>
<component-profile>
<property name="colorName" value="Blue">
<property name="personalization" value="dialog"/>
<property name="type" value="select[Red,Orange,Green,Blue,Yellow,Purple,Violet]"/>
<property name="plainDescription" value="Favorite Color"/>
</property>
<property name="location" value="Pune">
<property name="personalization" value="dialog"/>
<property name="plainDescription" value="Country of Residence"/>
</property>
<property name="petsName" value="Tommy">
<property name="personalization" value="dialog"/>
<property name="plainDescription" value="Pets Name"/>
</property>
</component-profile>
</component>
</components>
<services/>
</application>
Regards,
Dhruv Shah -
Handling Multi-Valued attribute in trusted reconciliation
Hi,
We have a requirement where an attribute is multi-valued in LDAP(Sun One Directory Server) which is a trusted source for OIM. We wanted to use oracle Out-of-the-Box connector for Sun Java System Directory Server. We wanted to bring in this multi-valued attribute into OIM, concatenate everything and populate it to a OIM User form attribute. Hence though the value is multi-valued in trusted source, we process it and populate as a single valued attribute in OIM. Since we run trusted reconciliation we are unable to bring this multivalued attribute for the user into OIM.
Can anybody suggest any other workaround available to achieve this functionality without touching connector source code?
Any help would be greatly appreciated.
Regards
DeepaI would highly suggest writing your own custom code.
You'll need to create a UDF that is large enough to handle your concatenated value. A resource object marked as trusted object. A provisioning process defintion to map the value to the field.
Then write a custom scheduled task that will connect to the LDAP directory, perform your search using the modifytimestamp attribute to get all the values. Concatenate them together in your code and create the reconciliation event.
It will turn out to be smoother than dealing with an entity adapter that runs everytime an event occurs which might not be related to this item.
-Kevin -
How To Import Into A Table with Multi-Value Fields
Hello:
I have a table with a multi-value field that contains states in which a company does business. It is multi-value because there can be more than one state. I tried to import a text tab-delimited file in which the data was arranged as follows:
Field1 Tab Field 2 Tab OR, WA, CA Tab
The "State field contained the multiple entries separated by a comma (like they appear in a query of the multi-value field), but it won't accept it. Does anyone know how to import into a multi-value field?
Thanks,
Rich Locus, Logicwurks, LLCJoana:
Here's the code I used to populate a multi-value field from a parsed field. The parsing routine could be greatly improved by using the Split function, but at that time, I had not used it yet. FYI... the field name of the multi-value field in
the table was "DBAInStatesMultiValue", which you can see in the example below how it is integrated into the code.
Option Compare Database
Option Explicit
Option Base 1
Dim strInputString As String
Dim intNumberOfArrayEntries As Integer
Dim strStateArray(6) As String
' Loop Through A Table With A Multi-Value Field
' And Insert Values Into the Multi-Value Field From A
' Parsed Regular Text Field
Public Function InsertIntoMultiValueField()
Dim db As DAO.Database
' Main Recordset Contains a Multi-Value Field
Dim rsBusiness As DAO.Recordset2
' Now Define the Multi-Value Fields as a RecordSet
Dim rsDBAInStatesMultiValue As DAO.Recordset2
' The Values of the Field Are Contained in a Field Object
Dim fldDBAInStatesMultiValue As DAO.Field2
Dim i As Integer
' Open the Parent File
Set db = CurrentDb()
Set rsBusiness = db.OpenRecordset("tblBusiness")
' Set The Multi-Value Field
Set fldDBAInStatesMultiValue = rsBusiness("DBAInStatesMultiValue")
' Check to Make Sure it is Multi-Value
If Not (fldDBAInStatesMultiValue.IsComplex) Then
MsgBox ("Not A Multi-Value Field")
rsBusiness.Close
Set rsBusiness = Nothing
Set fldDBAInStatesMultiValue = Nothing
Exit Function
End If
On Error Resume Next
' Loop Through
Do While Not rsBusiness.EOF
' Parse Regular Text Field into Array For Insertion into Multi-Value
strInputString = rsBusiness!DBAInStatesText
Call ParseInputString
' If Entries Are Present, Add Them To The Multi-Value Field
If intNumberOfArrayEntries > 0 Then
Set rsDBAInStatesMultiValue = fldDBAInStatesMultiValue.Value
rsBusiness.Edit
For i = 1 To intNumberOfArrayEntries
rsDBAInStatesMultiValue.AddNew
rsDBAInStatesMultiValue("Value") = strStateArray(i)
rsDBAInStatesMultiValue.Update
Next i
rsDBAInStatesMultiValue.Close
rsBusiness.Update
End If
rsBusiness.MoveNext
Loop
On Error GoTo 0
rsBusiness.Close
Set rsBusiness = Nothing
Set rsDBAInStatesMultiValue = Nothing
End Function
Public Function ParseInputString()
Dim intLength As Integer
Dim intStartSearch As Integer
Dim intNextComma As Integer
Dim intStartOfItem As Integer
Dim intLengthOfItem As Integer
Dim strComma As String
strComma = ","
intNumberOfArrayEntries = 0
strInputString = Trim(strInputString)
intLength = Len(strInputString)
' Skip Zero Length Strings
If intLength = 0 Then
Exit Function
End If
' Strip Any Leading Comma
If Mid(strInputString, 1, 1) = "," Then
Mid(strInputString, 1, 1) = " "
strInputString = Trim(strInputString)
intLength = Len(strInputString)
If intLength = 0 Then
Exit Function
End If
End If
' Strip Any Trailing Comma
If Mid(strInputString, intLength, 1) = "," Then
Mid(strInputString, intLength, 1) = " "
strInputString = Trim(strInputString)
intLength = Len(strInputString)
If intLength = 0 Then
Exit Function
End If
End If
intStartSearch = 1
' Loop Through And Parse All the Items
Do
intNextComma = InStr(intStartSearch, strInputString, strComma)
If intNextComma <> 0 Then
intNumberOfArrayEntries = intNumberOfArrayEntries + 1
intStartOfItem = intStartSearch
intLengthOfItem = intNextComma - intStartOfItem
strStateArray(intNumberOfArrayEntries) = Trim(Mid(strInputString, intStartOfItem, intLengthOfItem))
intStartSearch = intNextComma + 1
Else
intNumberOfArrayEntries = intNumberOfArrayEntries + 1
intStartOfItem = intStartSearch
intLengthOfItem = intLength - intStartSearch + 1
strStateArray(intNumberOfArrayEntries) = Trim(Mid(strInputString, intStartOfItem, intLengthOfItem))
End If
Loop Until intNextComma = 0
End Function
Regards,
Rich Locus, Logicwurks, LLC
http://www.logicwurks.com -
Multi-Valued Properties in XML Forms
Hello,
Can anyone tell me how to select multiple values for multi-valued properties in an XML Forms. It seems that the combo box only allows you to select one value.
Thanks,
Chris.Hi Chris,
nice to hear, that you're implementing my way of solving this multi value issue. And much nicer to hear, that it seems to work for you, too!
You can not write back your multi value properties from XML form. Thats for sure. You can think of:
1. Synchronize the value of your text field property with the value of the multi value propery whenever you store the document. This could be done using the event "property set".
<a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5d0ab890-0201-0010-849d-98d70bd1d5f0">See: KM Events</a>
2. Overwrite the content of your multi value property at runtime, depending on the value of the single value property which holds the csv. Do this by using a Repository Filter. <a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/70ee3a57-0701-0010-3e9a-ddae7e4e0521">See: RepositoryFilter</a>
3. Forget about the multi value property and make the text field property indexable. This should work, too.
All three options should work!
HTH,
Carsten
Maybe you are looking for
-
please help me!!!! my macbook pro 15 running on mountain lion is hanging a lot...sometimes when i use any app than it get freeze for some seconds...what should i do?
-
MSDS - different e-mail-addresses for the sender
Hi, we want to set up e-mail/INT for MSDS. Depending on the initiator we would like to have different e-mail addresses as sender. At the moment it's the e-mail-address of the batch-user of the job. - Can I split the jobs for each initiator? (How?) -
-
Hi, I use an HP Mini 210-1099.TU. It has served me very well so far but since a few days the right side of the screen doesnt stop fickering. I have tried system restore to an earlier date and taken all steps as advised by 'Windows Help' regarding br
-
Selection-screen - add default value to multiple selection
Hi, How I can add a default value for multiple selection, on a Select-options? Thanks in advance, Brian Gonsales
-
HT201210 My updates doesn't show up?
My iTunes icon shows there are updates but when I tried to go in, it just shows a blank page.