Lenka.Guo 发表于 2020-2-6 15:56
JSViewer 传参是 JSViewer 的接口,在报表展示时候会传给报表,并生效。
如果是在程序中获取报表参数的值 ...
这样确实可以在GetReport函数中获取,但是我需要在LocateDataSource方法中调用,在GetReport函数中获取的参数能传递到LocateDataSource中吗?因为现在需求是需要在LocateDataSource中获取报表的名称和外部传递进来的动态参数条件。
您可以在Startup 函数里面将获取到这些值存储为全局变量就可以在 LocateDataSource 方法里面使用了。 Lenka.Guo 发表于 2020-2-6 15:56
JSViewer 传参是 JSViewer 的接口,在报表展示时候会传给报表,并生效。
如果是在程序中获取报表参数的值 ...
这个Id 限制长度了? 测试的时候发现当字符串长度超过一定长度就会报错。 超过长度,导出的时候才会 报错吧,正常传递是么有问题的,如果是这样可以这样操作:https://gcdn.grapecity.com.cn/forum.php?mod=viewthread&tid=74038&extra=page%3D1 KearneyKang 发表于 2020-4-2 16:04
超过长度,导出的时候才会 报错吧,正常传递是么有问题的,如果是这样可以这样操作:https://gcdn.grapecit ...
不是导出报错,而是直接显示报表的时候就会提示错误(Cannot obtain report info)。用的是最新的ar14,进不了GetReport方法。
public void Configuration(IAppBuilder app)
{
app.UseErrorPage();
var dataSetsService = new FileSystemDataSets(DataSetsRootDirectory);
var templatesService = new FileSystemTemplates(TemplatesRootDirectory);
app.Use((context, next) =>
{
context.Set(typeof(IDataSetsService).ToString(), dataSetsService);
context.Set(typeof(ITemplatesService).ToString(), templatesService);
return next.Invoke();
});
app.UseDesigner(config => config.UseFileStore(ResourcesRootDirectory, false));
//app.UseReporting(config => config.UseFileStore(ResourcesRootDirectory));
app.UseReporting(settings =>
{
settings.UseCompression = true;
settings.UseFileStore(ResourcesRootDirectory);
settings.UseCustomStore(GetReport);
settings.LocateDataSource = args =>
{
DataTable dtblResult = new DataTable();
string FileType = args.Report.Author.ToString();//报表类别
string parasList = args.Report.Description.ToString();//查询差数
switch (FileType)
{
default://测试模板
{
break;
}
}
return dtblResult;
};
});
app.UseStaticFiles(new StaticFileOptions { FileSystem = new PhysicalFileSystem(String.Format(@"{0}.\wwwroot\", HttpRuntime.AppDomainAppPath)) });
} 你的前端传递的参数的位数有多少位,我这边根据你的情况去进行测试下看看。
Cannot obtain report info这个报错可能不是参数的问题导致的,可能是缺失引用导致的,你看看这个博客:https://gcdn.grapecity.com.cn/forum.php?mod=viewthread&tid=74434&extra=page%3D1,最后又解决这个问题的办法,你看看 KearneyKang 发表于 2020-4-2 17:59
你的前端传递的参数的位数有多少位,我这边根据你的情况去进行测试下看看。
Cannot obtain report info这 ...
位数不固定,会根据前端传递的参数个数变化。参数少的时候没问题,参数多了就会报错,现在会报错的那个总参数位数超过600位。
{
"PrintMan":"",
"SearchRegionId":-1,
"NumberPlate":"",
"ProductVarietyName":"",
"BottleBarcode":"",
"OutFactoryNumber":"",
"OperMan":"",
"StartDate":"",
"EndDate":"",
"HQId":1,
"RegionId":2,
"CompanyId":4,
"BelongId":4,
"pageIndex":1,
"pageSize":10,
"OnlyShowThisPage":0
} 前台传参600位参数,我说怎么没有测出来,我使用了100位参数,没有出现你说的问题,我再把参数位数加大试试 KearneyKang 发表于 2020-4-7 09:35
前台传参600位参数,我说怎么没有测出来,我使用了100位参数,没有出现你说的问题,我再把参数位数加大试试
参数长度过长这个问题能解决吗? 测试了没有出现你说的这个问题
页:
1
[2]