This is a migrated thread and some comments may be shown as answers.

Multivalue Guid Parameter

3 Answers 57 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Devin
Top achievements
Rank 1
Devin asked on 04 May 2012, 08:23 PM

I'm passing a report an array of guids converted to strings, into a multivalue parameter. My question, is how do I now get the report to pass that to my SQL query? The query looks like this:

SELECT        Name, Address, Address2, City, State, Zip, Phone, PrimaryContact, ExpirationDate
FROM            Companies
WHERE        (ID IN (@Companies))

Thanks

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 07 May 2012, 02:29 PM
Hello Devin,

Generally the report parameters support limited number of data types. Thus in order to utilize GUID array you have to add a few data converting user functions. Check out the How to use a Guid as value for report parameter or data source parameter? KB article and have in mind that you will have to convert a string array to a GUID array and vice versa.

All the best,
Peter
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

0
Devin
Top achievements
Rank 1
answered on 07 May 2012, 09:58 PM
I created the following method in the code for the report:
public static Guid[] ConvertToGuid(string[] guids)
{
    var tmpList = new System.Collections.Generic.List<Guid>();
    foreach (var g in guids)
    {
        tmpList.Add(new Guid(g));
    }
 
    return tmpList.ToArray();
}

Then I use the following for the data source parameter: =ConvertToGuid(Parameters.Companies.Value)

When I run it, I get this: "The expression contains undefined function call ConvertToGuid()."
0
Peter
Telerik team
answered on 08 May 2012, 09:57 AM
Hi Devin,

The multi value report parameter value is an object[]. Thus our suggestion is to change the user function parameters type from string[] to object[]

Additionally make sure the ReportParameter.MultiValue property set to true.

All the best,
Peter
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Tags
General Discussions
Asked by
Devin
Top achievements
Rank 1
Answers by
Peter
Telerik team
Devin
Top achievements
Rank 1
Share this question
or