I need to retrieve the variables (and their type) used in an MRT file.
Is there a standard way of doing this through your library or I will have to parse the MRT XML myself?
I see that the :
Code: Select all
StiReport.Variables
Thanks.

Code: Select all
StiReport.Variables
Code: Select all
StiReport.Dictionary.Variables
Code: Select all
StiReport report = ...;
report.RequestParameters = true;
Code: Select all
StiReport GetReport()
{
var report = new StiReport();
SetReportParameters(report);
report.Load(mrtFilePath);
}
public ActionResult GetReportSnapshot(ListModel model)
{
using(var report = GetReport(model))
{
return StiMvcViewer.GetReportSnapshotResult(HttpContext, report);
}
}
Code: Select all
StiReport.Dictionary.Variables
Code: Select all
new StiMvcViewerOptions()
{
...
ActionInteraction = "Interaction",
...
public ActionResult Interaction()
{
using (var report = GetReport())
{
return StiMvcViewer.InteractionResult(this.HttpContext, report);
}
}
The "ToDate" parameter is in the parameters area and it is filled-in when I press the submit!The parameterized query '............................' expects the parameter '@ToDate', which was not supplied.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at Stimulsoft.Report.Dictionary.StiSqlSource.UpdateParameters()
at Stimulsoft.Report.Dictionary.StiSqlAdapterService.ConnectDataSourceToData(StiDictionary dictionary, StiDataSource dataSource, Boolean loadData)
at Stimulsoft.Report.Dictionary.StiDataSource.Connect(StiDataCollection datas, Boolean loadData)
at Stimulsoft.Report.Dictionary.StiDataSourcesCollection.Connect(StiDataCollection datas, Boolean loadData)
at Stimulsoft.Report.Dictionary.StiDataSourcesCollection.Connect(Boolean loadData)
at Stimulsoft.Report.Dictionary.StiDictionary.Connect(Boolean loadData)
at Stimulsoft.Report.Dictionary.StiDictionary.Connect()
at Stimulsoft.Report.Engine.StiRenderProviderV2.ConnectToData(StiReport report)
at Stimulsoft.Report.Engine.StiRenderProviderV2.Render(StiReport report, StiRenderState state)
at Stimulsoft.Report.Engine.StiReportV2Builder.RenderSingleReport(StiReport masterReport, StiRenderState renderState)
at Stimulsoft.Report.StiReport.RenderReport(StiRenderState renderState)
at Stimulsoft.Report.StiReport.Render(StiRenderState renderState, StiGuiMode guiMode)
at Stimulsoft.Report.StiReport.Render(StiRenderState renderState)
at Stimulsoft.Report.StiReport.Render(Boolean showProgress, Int32 fromPage, Int32 toPage)
at Stimulsoft.Report.StiReport.Render(Boolean showProgress)
at Stimulsoft.Report.Mvc.StiMvcViewer.SaveReportObject(HttpContextBase httpContext, StiReport report)
at Stimulsoft.Report.Mvc.StiMvcViewer.InteractionResult(HttpContextBase httpContext, StiReport report)
Code: Select all
StiReport report = new StiReport();
report.Load(mrtFile);
report.RequestParameters = true;
Code: Select all
report.Dictionary.DataSources["MyDataSource"].Parameters[key].Value = (string)dic[key];
report.Dictionary.Variables[key].Value = (string)dic[key];
Code: Select all
report.Dictionary.Variables["usrID"].Value = ident.UserId.ToString(CultureInfo.InvariantCulture);
Code: Select all
report["usrID"] = ident.UserId;