Getting 'IEnumerable`1 parameters' error in RDLC file - reporting-services

I am facing some wierd issue with my RDLC file.
I have created some RDLC file for them which is throwing Microsoft.Reporting.WinForms.LocalReport.SetParameters(IEnumerable1 parameters)` error while calling.
I was using some parameters in a table and that table is associated to one dataset. When I remove the parameter from the table it's running fine.
Can't we use any parameters in a table in RDLC? The problem is if I am not putting this parameter inside the table it's very difficult to handle report layouts.
This is the code has been used to call the report.
LocalReport localReport = new LocalReport();
List<ReportParameter> reportParams = new List<ReportParameter>();
localReport.ReportPath = Path.Combine(reportPath, reportRequest.ReportName);
...
PMClientReportRequestDTO pmJUS = reportRequest as PMClientReportRequestDTO;
...
reportParams.Add(new ReportParameter("jusStoreAddress", storeAddress));
reportParams.Add(new ReportParameter("Culture", pmJUS.Culture));
localReport.ReportPath = Path.Combine(reportPath, pmJUS.ReportName + ".rdlc");
localReport.DataSources.Add(new ReportDataSource("PurchasedMetalItems", pmJUS.PurchaseItems));
....
localReport.SetParameters(reportParams);

Related

Are my Rails methods/helper functions executing every time anyone does a GET request to the server, in parallel? Is this an issue?

My website is mostly to display results, so the admin enters the results and they are rendered nicely for the users/clients. Currently, in my main_controller.rb and other controllers I have functions for the main index page...
def index
#next_tournament = helpers.next_tournament()
#last_tournament = helpers.last_tournament()
#last_tournament_date_display = helpers.last_tournament_date_display(#last_tournament)
#next_tournament_date_display = helpers.next_tournament_date_display(#next_tournament)
#current_season = #last_tournament.season_year
#aoys = helpers.display_aoy(#last_tournament.id)
#aoy_diff = helpers.aoy_point_diff(#aoys)
#individual_winners = helpers.individual_winners(#last_tournament.id)
#team_winners = helpers.team_winners(#last_tournament.id)
#big_bass_winners = helpers.big_bass_winners(#last_tournament.id)
#total_club_stats = helpers.total_club_stats()
#annual_club_stats = helpers.annual_club_stats(#current_season )
...
end
Does this mean, that for every person that navigates to my main index page the server will re-run these functions and spit out the result?
I'm trying to understand what happens on the server side. Would this be a problem? Most of these functions would only change when a new result is entered. Is it best practice to do something in the code, so that the function is only re-ran when any of the variables in the equation change, and otherwise static?

Set data in UNB segment EDIFACT

Do you know how I can set UNB in EDIFACT?
I have a CSV input file:
VRD1;100;200;0;0;L
And the output should be:
UNA:+.? '
UNB+UNOA:2+100:14+200:14+200305:0704+00000000000000++AAA'
UNH+1+INVRPT:D:96A:UN:EAN005'
BGM+10::9+20200305070403+9
I have to map the second and third fields to UNB.
I appreciate any help in this regard. Thank you in advance.
You should be able to do this using the EdiOverride message context properties. You can find them in the Microsoft.BizTalk.Edi.BaseArtifacts assembly found in the BizTalk Server installation folder.
For instance, in an orchestration, you can do this:
EdifactMessage(EdiOverride.OverrideEDIHeader) = true;
EdifactMessage(EdiOverride.UNB2_1) = xpath(CsvMessage, ...); // 100
EdifactMessage(EdiOverride.UNB3_1) = xpath(CsvMessage, ...); // 200
Add a correlation set with the same properties to your send shape.
If you want to set them in a pipeline, use the property namespace http://schemas.microsoft.com/BizTalk/2006/edi-properties.

How can I create a foreach loop with "Foreach From Variable Enumerator" in SSIS programmatically

I'm trying to create an SSIS package dynamically using DTS Runtime classes.
I'm trying to create a foreach loop using "Foreach From Variable Enumerator", where my variable contains an ArrayList with the necessary collection.
I'm unable to find a way through which i can set the variable (under enumerator configuration, as seen in VS) which will hold the collection for looping.
I'm not finding any options in forEachLoop.ForEachEnumerator. Nor am I able to cast forEachEnumeratorHost.InnerObject to an enumerator I want. I found on MSDN a class Microsoft.SqlServer.Dts.Runtime.Enumerators.FromVar.ForEachFromVarEnumerator. But I'm not able to find the FromVar class in Enumerators. Am i missing something grave?
Has anyone else done this? I find it difficult to believe that something which can be done so easily through Visual Studio UI, cannot be done programmatically.
Below is the code I have now...
ForEachLoop forEachLoop = p.Executables.Add("STOCK:FOREACHLOOP") as
ForEachLoop;
// Create a VariableMappings and VariableMapping objects.
ForEachVariableMapping forEachVariableMapping =
forEachLoop.VariableMappings.Add();
// Create a mapping between the variable and its value.
forEachVariableMapping.VariableName = #"User::CurrentTableName";
forEachVariableMapping.ValueIndex = 0;
ForEachEnumeratorInfo forEachEnumeratorInfo =
runtimeApp.ForEachEnumeratorInfos["Foreach From Variable Enumerator"];
ForEachEnumeratorHost forEachEnumeratorHost =
forEachEnumeratorInfo.CreateNew();
You are almost there...I think you are forgetting to set the ForEachEnumerator property of the forEachLoop object.
ForEachLoop forEachLoop = p.Executables.Add("STOCK:FOREACHLOOP") as ForEachLoop;
ForEachEnumeratorInfo forEachEnumeratorInfo = runtimeApp.ForEachEnumeratorInfos["Foreach From Variable Enumerator"];
ForEachEnumeratorHost forEachEnumeratorHost = forEachEnumeratorInfo.CreateNew();
//forEachEnumeratorHost.CollectionEnumerator = false; // true or false; set accordingly.
// cast the inner object to ForEachFromVarEnumerator
ForEachFromVarEnumerator = forEachEnumeratorHost.InnerObject as ForEachFromVarEnumerator;
// Now that you have the ForEachFromVarEnumerator, set its properties.
// For variable name, do not forget the variable's name space and the variable name (separated by ::)
ForEachFromVarEnumerator.VariableName = "var_namespace" + "::" + "var_name";
// finally.....
forEachLoop.ForEachEnumerator = forEachEnumeratorHost; // DO NOT FORGET THIS. Here you are setting what the actual enumerator would be
You can do like this:
Script task
Make sure MyList variable is Writeable
ArrayList NewList = new ArrayList();
NewList.Add("Ost");
NewList.Add("Hest");
Dts.Variables["User::MyList"].Value = NewList;
Dts.TaskResult = (int)ScriptResults.Success;
The first step is
Add an assembly reference to Microsoft.SqlServer.ForEachFromVarEnumerator.dll and then one can get access to the Microsoft.SqlServer.Dts.Runtime.Enumerators.FromVar.ForEachFromVarEnumerator class.
And then the rest of the answer is exactly what #Sam has mentioned above.

SSRS 2008 R2 Check if external image exists on report server

I'm working on an SSRS 2008 R2 report and I'm displaying images dynamically. I would like to hide the image box and display an icon with text that reads "Image not found" if the image doesn't exist on our report server.
I've tried a few things with expressions, but I can't get them to correctly return true or false, based on if the image exists or not.
The expression I'm using to display the image is:
="/BusinessIntelligence/Drilldown Reports/" + Fields!item.Value + ".jpg"
To test if I could get the report to detect whether the image existed, I dragged a textbox onto my report and tried the following expressions in an attempt to return True or False.
=IIf(IsNothing("/BusinessIntelligence/Drilldown Reports/" + Fields!item.Value + ".jpg"), "Woohoo!", "Do'h!") this always returns False, even if the image exists.
I even tried using some custom code I found here.
Code:
Function IsValid(ByVal Url As String) As Boolean
Dim sStream As IO.Stream
Dim URLReq As Net.HttpWebRequest
Dim URLRes As Net.HttpWebResponse
Try
URLReq = Net.WebRequest.Create(Url)
URLReq.Credentials = System.Net.CredentialCache.DefaultCredentials
URLRes = URLReq.GetResponse()
sStream = URLRes.GetResponseStream()
Dim reader As String = New IO.StreamReader(sStream).ReadToEnd()
Return True
Catch ex As Exception
Return False
End Try
End Function
And the expression I used for that code is:
=IIf(Code.IsValid("/BusinessIntelligence/Drilldown Reports/" + Fields!item.Value + ".jpg"), "Woohoo!", "Do'h!")
But this also always just returns false.
ok, I needed this thanks.
Your error here is you are using a reserve word for a webpage IsValue. Change your function name to IsThere and it should work famously.

Generate Report object in ssrs

I have a requirement of generating the rdl in runtime. so I converted the http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition xsd to class and I need to create object for Report class with that it has lot of classes. I am struggling in the report generation using objects
I don't know how to assign values
[System.Xml.Serialization.XmlAnyElementAttribute()]
[System.Xml.Serialization.XmlElementAttribute("Author", typeof(string))]
[System.Xml.Serialization.XmlElementAttribute("AutoRefresh", typeof(uint))]
[System.Xml.Serialization.XmlElementAttribute("Body", typeof(BodyType))]
private ItemsChoiceType37[] itemsElementNameField;
Please help me.
It is something like
List<object> items = new List<object>();
List<ItemsChoiceType37> itemChoices = new List<ItemsChoiceType37>();
//Author
items.Add("Author name");
itemChoices.Add(ItemsChoiceType37.Author);
items.Add(description);
itemChoices.Add(ItemsChoiceType37.Description);
//Width
items.Add("11in");
itemChoices.Add(ItemsChoiceType37.Width);
.
.
.
Report report = new Report();
report.Items = items.ToArray();
report.ItemsElementName = itemChoices.ToArray();
I hope it may help you