Although this has been asked before, none of the answers provided solve my issue. I AM passing in all of the required report parameters and all have HasValidValue set in the State property of the parameter array of ExecutionInfo. I am using ReportExecution2005.asmx in my ASP.NET web application. There is no GetParameters() call method to ReportExecution2005.ReportExecutionService object.
My report is calling a subreport so the input parameters are identical to the main report and the subreport. There are 4 single value inputs (two integer, two text) and then one Multivalue text input parameter which I supply multiple values for. I have double and tripled checked that the values I'm setting in the Multivalue input parameter match exactly one of the default parameters.
Here is the code that setups up the reports and renders/writes it out to a PDF file:
protected void btnPrintReq_Tests_Click(object sender, EventArgs e)
{
string query = string.Format("SELECT PatientFName, PatientLName, Address1 + ' ' + Address2 AS Address, City, Region AS State, PostalCode, Email, Phone, Gender, DOB, CONVERT(VARCHAR, ClinicID) AS ClinicID FROM Tbl_ShippingDropShip WHERE RequestID = {0}", giRequestID.ToString());
string sClinicID = string.Empty;
try
{
//get the drop ship test order details
SqlDataReader reader = default(SqlDataReader);
reader = o_cSQL.RunSQLReturnDataReader(query);
REService.ReportExecutionService rs_ext = new REService.ReportExecutionService();
rs_ext.Credentials = System.Net.CredentialCache.DefaultCredentials;
rs_ext.Url = ConfigurationManager.AppSettings["ReportExecutionServer"];
List<string> ordereditems = new List<string> { };
ordereditems = GetOrderedItems(); //panels and profiles
int numordereditems = ordereditems.Count;
List<String> comments = new List<String>();
if (cbIce.Checked)
comments.Add("Ice");
if (cbKit.Checked)
comments.Add("Kit");
if (cbSwabs.Checked)
comments.Add("Swabs");
if (cbGoldTop.Checked)
comments.Add("Gold Top");
if (cbNeedlePack.Checked)
comments.Add("Needle Pack");
if (cbButterflyPack.Checked)
comments.Add("Butterfly Pack");
if (comments.Count == 0)
comments.Add("");
byte[] result = null;
string historyID = null;
string devInfo = null;
string encoding;
string mimeType;
string extension;
REService.Warning[] warnings = null;
string[] streamIDs = null;
//define the size of the parameter array to pass into the REService
REService.ParameterValue[] rValues = new REService.ParameterValue[4 + numordereditems];
while (reader.Read())
{
sClinicID = reader["ClinicID"].ToString();
rValues[0] = new REService.ParameterValue();
rValues[0].Name = "ClinicID";
rValues[0].Value = sClinicID;
rValues[1] = new REService.ParameterValue();
rValues[1].Name = "ReqFormID";
rValues[1].Value = giRequestID.ToString();
rValues[2] = new REService.ParameterValue();
rValues[2].Name = "DropShipID";
rValues[2].Value = giDropShipID.ToString();
rValues[3] = new REService.ParameterValue();
rValues[3].Name = "Comments";
rValues[3].Value = string.Join(",",comments.ToArray());
int j = 0;
for (int i = 4; i < rValues.Length; i++)
{
rValues[i] = new REService.ParameterValue();
rValues[i].Name = "PanelsNProfiles";
rValues[i].Label = "Panels and Profiles :";
rValues[i].Value = ordereditems[j++];
}
}
REService.ExecutionInfo res_info = new REService.ExecutionInfo();
res_info = rs_ext.LoadReport("/zReportSandbox/RequisitionDS", historyID);
res_info = rs_ext.SetExecutionParameters(rValues, "en-us");
res_info = rs_ext.GetExecutionInfo();
result = rs_ext.Render("PDF", devInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);
string pdfFile = "Requisition_" + giRequestID.ToString() + "_"+ txtPatientName_Edit.Text + ".pdf";
string sPDFSavePath = ConfigurationManager.AppSettings["Shipping_Requisitions"] + sClinicID;
//add the date pathing
sPDFSavePath = ReportHelper.CreateDateDirectories(sPDFSavePath);
//make sure the file doesn't already exist and if it does, delete it so we create a new one
ReportHelper.checkPDFfilesNDirectory(sPDFSavePath +#"\", pdfFile);
FileStream stream = File.Create(sPDFSavePath + #"\" + pdfFile, result.Length);
stream.Write(result, 0, result.Length);
stream.Close();
}
catch(Exception ex)
{
Common.CommonUtilities.FatalError(sPageName, "btnPrintReq_Tests_Click", query, ex.Message.ToString(), ex.ToString());
}
}
I have noticed that the ExecutionInfo item shows me all parameters in the array of the report, meaning the required INPUT parameters AND the INTERNAL parameters, but also noticed that for the INTERNAL parameters, the default value that was set in the report is satisfied and ExecutionInfo shows them with the State of HasValidValue.
The following list is what I know
the report works on its own, so the Main report that calls the Subreport has no issues creating the PDF
there report when run in SSRS does prompt for the 4 input parameters
I have tried the removal of the report in SSRS and redeployed it because there were many that suggested this somehow fixes issues like this.
I have tried the Insert a table, delete the columns and put subreport in one cell of table trick and still the same error.
It would be nice if the error would state what parameter it sees as not being satisfied, even if there are more than one, then simply listing the first one before erroring out would help a developer work through the issues.
The attached picture shows the values I'm passing in for the multivalue parameters (PanelsNProfiles). I'm also attaching my RDL files for the main report and the Subreport, but had to add a (.txt) file extension to them to be able to upload them.
Here is the error in the SSRS execution log:
library!ReportServer_0-57!5250!03/23/2022-09:06:27:: i INFO: RenderForNewSession('/zReportSandbox/RequisitionDS')
processing!ReportServer_0-57!5250!03/23/2022-09:06:27:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: , Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: One or more parameters required to run the report have not been specified.;
reportrendering!ReportServer_0-57!5250!03/23/2022-09:06:27:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.RenderingObjectModelException: , Microsoft.ReportingServices.ReportProcessing.RenderingObjectModelException: One or more parameters were not specified for the subreport, 'RequisitionTopDS', located at: /zReportSandbox/RequisitionTopDS.;
processing!ReportServer_0-57!5250!03/23/2022-09:06:27:: e ERROR: An error has occurred while processing a sub-report. Details: One or more parameters were not specified for the subreport, 'RequisitionTopDS', located at: /zReportSandbox/RequisitionTopDS. Stack trace:
at Microsoft.ReportingServices.OnDemandReportRendering.SubReport.FinalizeErrorMessageAndThrow()
at Microsoft.ReportingServices.OnDemandReportRendering.SubReport.RetrieveSubreport()
I am using json-schema validator for validating json data. if any error occur it will generate a report. But I want to show the error to the user the report is too big so I want to show only error messages.
This is my report
----------reports-------------
com.github.fge.jsonschema.report.ListProcessingReport: failure
--- BEGIN MESSAGES ---
error: instance failed to match at least one required schema among 4
level: "error"
schema: {"loadingURI":"#","pointer":"/properties/question-groups/items"}
instance: {"pointer":"/question-groups/0"}
domain: "validation"
keyword: "anyOf"
nrSchemas: 4
reports: {"/properties/question-groups/items/anyOf/0":[{"level":"error","schema":{"loadingURI":"#","pointer":"/definitions/multiple-choice/properties/evaluation-key/properties/options/items"},"instance":{"pointer":"/question-groups/0/evaluation-key/options/0"},"domain":"validation","keyword":"allOf","message":"instance failed to match all required schemas (matched only 0 out of 1)","matched":0,"nrSchemas":1,"reports":{"/definitions/multiple-choice/properties/evaluation-key/properties/options/items/allOf/0":[{"level":"error","schema":{"loadingURI":"#","pointer":"/definitions/multiple-choice/properties/evaluation-key/properties/options/items/allOf/0/properties/score"},"instance":{"pointer":"/question-groups/0/evaluation-key/options/0/score"},"domain":"validation","keyword":"type","message":"instance type (string) does not match any allowed primitive type (allowed: [\"integer\"])","found":"string","expected":["integer"]}]}}],"/properties/question-groups/items/anyOf/1":[{"level":"error","schema":{"loadingURI":"#","pointer":"/definitions/text/properties/evaluation-key"},"instance":{"pointer":"/question-groups/0/evaluation-key"},"domain":"validation","keyword":"additionalProperties","message":"object instance has properties which are not allowed by the schema: [\"options\"]","unwanted":["options"]},{"level":"error","schema":{"loadingURI":"#","pointer":"/definitions/text/properties/evaluation-key"},"instance":{"pointer":"/question-groups/0/evaluation-key"},"domain":"validation","keyword":"required","message":"object has missing required properties ([\"scorers\"])","required":["scorers"],"missing":["scorers"]},{"level":"error","schema":{"loadingURI":"#","pointer":"/definitions/text/properties/type"},"instance":{"pointer":"/question-groups/0/type"},"domain":"validation","keyword":"enum","message":"instance value (\"multiple-choice\") not found in enum (possible values: [\"text\"])","value":"multiple-choice","enum":["text"]}],"/properties/question-groups/items/anyOf/2":[{"level":"error","schema":{"loadingURI":"#","pointer":"/definitions/numeric/properties/evaluation-key"},"instance":{"pointer":"/question-groups/0/evaluation-key"},"domain":"validation","keyword":"additionalProperties","message":"object instance has properties which are not allowed by the schema: [\"options\"]","unwanted":["options"]},{"level":"error","schema":{"loadingURI":"#","pointer":"/definitions/numeric/properties/evaluation-key"},"instance":{"pointer":"/question-groups/0/evaluation-key"},"domain":"validation","keyword":"required","message":"object has missing required properties ([\"scorers\"])","required":["scorers"],"missing":["scorers"]},{"level":"error","schema":{"loadingURI":"#","pointer":"/definitions/numeric/properties/type"},"instance":{"pointer":"/question-groups/0/type"},"domain":"validation","keyword":"enum","message":"instance value (\"multiple-choice\") not found in enum (possible values: [\"numeric\"])","value":"multiple-choice","enum":["numeric"]}],"/properties/question-groups/items/anyOf/3":[{"level":"error","schema":{"loadingURI":"#","pointer":"/definitions/table"},"instance":{"pointer":"/question-groups/0"},"domain":"validation","keyword":"anyOf","message":"instance failed to match at least one required schema among 2","nrSchemas":2,"reports":{"/definitions/table/anyOf/0":[{"level":"error","schema":{"loadingURI":"#","pointer":"/definitions/table/anyOf/0"},"instance":{"pointer":"/question-groups/0"},"domain":"validation","keyword":"required","message":"object has missing required properties ([\"cells\"])","required":["cells","evaluation-key","group-id","question-text","type"],"missing":["cells"]}],"/definitions/table/anyOf/1":[{"level":"error","schema":{"loadingURI":"#","pointer":"/definitions/table/anyOf/1"},"instance":{"pointer":"/question-groups/0"},"domain":"validation","keyword":"required","message":"object has missing required properties ([\"cells\",\"matching-unit\"])","required":["cells","evaluation-key","group-id","matching-unit","question-text","type"],"missing":["cells","matching-unit"]}]}}]}
--- END MESSAGES ---
How can I get only error messages, any suggestions will be help full.
Thank you
somu
You can read the report as a JsonNode and get what ever parameter you need from that.
ProcessingReport report;
ProcessingMessage message;
report = schema.validate(jsonData);
Iterator itr = report.iterator();
while(itr.hasNext())
{
message = (ProcessingMessage) itr.next();
System.out.println("Message" + message.asJson().get("message").asText());
System.out.println("Reports" + message.asJson().get("reports").asText());
}
You should iterate over all messages and choose only errors comparing getLogLevel() with LogLevel.ERROR. That works for me
Iterator<ProcessingMessage> itr = report.iterator();
while(itr.hasNext())
{
ProcessingMessage message = (ProcessingMessage) itr.next();
if(message.getLogLevel().equals(LogLevel.ERROR)){
System.out.println(message.toString());
}
}
You can use the following method
String getErrorsList(ProcessingReport report, boolean onlyErrors) {
StringBuilder jsonValidationErrors = new StringBuilder();
for (ProcessingMessage processingMessage : report) {
if(onlyErrors && LogLevel.ERROR.equals(processingMessage.getLogLevel())) {
jsonValidationErrors.append(processingMessage.getMessage()).append("\n\r");
} else if(!onlyErrors) {
jsonValidationErrors.append(processingMessage.getMessage()).append("\n\r");
}
}
return jsonValidationErrors.toString();
}
Following piece of code returning following error not sure where is the problem,
Exception Details: System.ArgumentException: Value does not fall within the expected range.
public static SPUser convertStringToSPUser(string struser)
{
SPFieldUserValue userValue = new SPFieldUserValue(SPContext.Current.Web, struser);
SPUser objSPUser = userValue.User;
return objSPUser;
}
My string is something like, "S, Rishi".
In order to create an instance of SPFieldUserValue you should Pass a string with the following format:
[int];#[domain]\[username]
The easiest way to get that value from a list item is:
ListItem[field_GUID].ToString();
I am trying to create a sharepoint calendar event using client object model. I can create item and set column values all columns except "EndDate" column. When I try to set this column I get the following error Translation of message from German is "Invalid data is used while updating list entry. The field you want to update is possibly write protected." If skip this column, list item created at Sharepoint server without enddate property, but it is not visible at calendar view. I can see item on "datasheetview" type of view, and if I set the enddate from here it is also visible at calendar view.(strange thing is it is mandatory field)
Server Exception Microsoft.SharePoint.Client.ServerException was unhandled. Message=Es wurden ungültige Daten zur Aktualisierung des Listeneintrags verwendet. Das Feld, das Sie aktualisieren möchten, ist möglicherweise schreibgeschützt. Source=Microsoft.SharePoint.Client.Runtime ServerErrorCode=-2147024809 ServerErrorTypeName=System.ArgumentException ServerStackTrace="" StackTrace:
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
at Sp_Ctx.Program.Main(String[] args) in_Ctx\Program.cs:line 129 InnerException:
my code is as follows
using (ClientContext ctx = ClaimClientContext.GetAuthenticatedContext(targetSite)){ if (ctx != null) {
ctx.Load(ctx.Web); // Query for Web
ctx.ExecuteQuery(); // Execute
Console.WriteLine(ctx.Web.Title);
List list = ctx.Web.Lists.GetByTitle("calendarListName");
ctx.Load(list.Fields);
ctx.ExecuteQuery();
var newItem = list.AddItem(listItemCreationInfo);
newItem.Update();
newItem["Title"] = "myCalendar" .....
newItem["EventDate"]= DateTime.Now;
newItem["EndDate"]= DateTime.Now.AddMinutes(30);
newItem["Location"]= "Office";
newItem.Update();
ctx.ExecuteQuery();
}
Answer was simple update the eventdate and the enddate together. Original solution is can be seen here
This one is weird.
I'm executing this code in a Timer Job in SharePoint 2010 ...
...
// Get the field by it's internal name
SPField field = item.Fields.GetFieldByInternalName(fieldInternalName);
if (field != null)
{
SPFieldUser userField = (SPFieldUser)field;
object value = null;
if (userField.AllowMultipleValues)
{
// Bug when getting field value in a timer job? Throws an ArgumentException
users = new SPFieldUserValueCollection(item.ParentList.ParentWeb, item[userField.Id].ToString());
}
else
{
// Get the value from the field, no exception
value = item[userField.Id];
}
}
...
This code works perfectly when run in a simple ConsoleApplication but when run in the context of a Timer Job in SharePoint 2010 it throws an ArgumentException in the line ...
users = new SPFieldUserValueCollection(item.ParentList.ParentWeb, item[userField.Id].ToString());
I've tried many variations to retreive a value from a SPFieldUser but all fail only when a Timer Job is executing it and the field has AllowMultipleValues property set to TRUE.
I have tried debugging with Reflector and it seems that the exception is being thrown here in SPListItem ...
public object this[Guid fieldId]
{
get
{
SPField fld = this.Fields[fieldId];
if (fld == null)
{
throw new ArgumentException();
}
return this.GetValue(fld, -1, false);
}
...
And this here would be the exception stack trace...
System.ArgumentException was caught
Message=Value does not fall within the expected range.
Source=Microsoft.SharePoint
StackTrace:
at Microsoft.SharePoint.SPFieldMap.GetColumnNumber(String strFieldName, Boolean bThrow)
at Microsoft.SharePoint.SPListItemCollection.GetColumnNumber(String groupName, Boolean bThrowException)
at Microsoft.SharePoint.SPListItemCollection.GetRawValue(String fieldname, Int32 iIndex, Boolean bThrow)
at Microsoft.SharePoint.SPListItem.GetValue(SPField fld, Int32 columnNumber, Boolean bRaw, Boolean bThrowException)
at Microsoft.SharePoint.SPListItem.get_Item(Guid fieldId)
at FOCAL.Point.Applications.Audits.AuditUtility.GetPeopleFromField(SPListItem item, String fieldInternalName)
Sighh... any thoughts?
This generally means that you have requested too many lookup fields in a single SPQuery which would cause too many self-joins of the true-lookup-table in the content database unless SharePoint Foundation throttled resources. There is a threshold setting that is at 8 lookups per query for ordinary users. Make sure your query only returns the necessary lookup or person/group fields. If you can't decrease the usage, then consider altering the threshold setting.