Passing Guid as parameter to a sub-report does not work

Stimulsoft Reports.WEB discussion
Post Reply
lamthanha
Posts: 9
Joined: Thu Dec 20, 2018 8:34 am

Passing Guid as parameter to a sub-report does not work

Post by lamthanha »

Hi,

I'm trying to make a master-details with sub-report by passing a Guid parameter but somehow it doesn't work as expected.
Let's say there are 2 pages: Master and Details.
In Master, we have DataBand1 with the parent data source and a sub-report (let's call it Sub) that points to Details.
In Details, there is DataBand2 with the child source, and filter by parent's Id, let's call it pId.
In Sub, I added a parameter named pId, and passed the parent's Id variable, then I've tried the following ways for the Filters of DataBand2:
- pId equal to this["pId"] => Blank
- pId equal to (Guid)this["pId"] => Blank
- pId equal to Guid.Parse(this["pId"]) => Blank
- pId equal to new Guid(this["pId"]) => Blank
- pId equal to (new Guid(this["pId"])) => Blank
- Expression: pId == this["pId"] => Exception
- Expression: pId == (Guid)this["pId"] => Blank
- Expression: pId == Guid.Parse(this["pId"]) => Exception, obviously
- Expression: pId == Guid.Parse(this["pId"].ToString()) => Blank
- Expression: pId == new Guid(this["pId"]) => Exception
- Expression: pId == new Guid(this["pId"].ToString()) => Blank
I even tried a hard-coded value for the Filters:
- pId equal to 379e020c-0eea-477c-8f02-f7c6dc2b86b0 => The only one that works
- pId equal to "379e020c-0eea-477c-8f02-f7c6dc2b86b0" => Blank
- pId equal to new Guid("379e020c-0eea-477c-8f02-f7c6dc2b86b0") => Blank
- pId equal to (Guid)"379e020c-0eea-477c-8f02-f7c6dc2b86b0" => Blank
- pId equal to Guid.Parse("379e020c-0eea-477c-8f02-f7c6dc2b86b0") =>
- Expression: pId == (Guid)"379e020c-0eea-477c-8f02-f7c6dc2b86b0" => Exception
- Expression: pId == "379e020c-0eea-477c-8f02-f7c6dc2b86b0" => Exception

- Expression: pId == 379e020c-0eea-477c-8f02-f7c6dc2b86b0 => Exception
- Expression: pId == new Guid(379e020c-0eea-477c-8f02-f7c6dc2b86b0) => Exception
- Expression: pId == new Guid("379e020c-0eea-477c-8f02-f7c6dc2b86b0") => Blank
- Expression: pId == (Guid)(new Guid("379e020c-0eea-477c-8f02-f7c6dc2b86b0")) => Blank

I also tried passing pId as a hard-coded value in Sub:
- new Guid("379e020c-0eea-477c-8f02-f7c6dc2b86b0")
- "379e020c-0eea-477c-8f02-f7c6dc2b86b0"
- 379e020c-0eea-477c-8f02-f7c6dc2b86b0 => Exception right away
and repeated with the above Filters conditions but the result were the same.

So I wonder which the correct way to achieve this is, please help.

The reason why I don't use the traditional Master-Details approach is because I actually wanted to pass the next parent's Id as the parameter, i.e., Next(Datasource, "pId"), but it didn't work because of the exception "The name 'Next' does not exist in the current context", so I tried the above.

Thank you.
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: Passing Guid as parameter to a sub-report does not work

Post by Lech Kulikowski »

Hello,

Please send us a sample report with test data which reproduces the issue for analysis.

Thank you.
lamthanha
Posts: 9
Joined: Thu Dec 20, 2018 8:34 am

Re: Passing Guid as parameter to a sub-report does not work

Post by lamthanha »

Hi,

Sorry for the delay.
I created some static test data and tried generating the report, the problem did not happen, so maybe there is something wrong in my code.

But I still have the problem with passing Next value into sub-report.

In the master databand, I tried passing the Next ParentId, as in Screenshot_21.png, but an exception "The name 'Next' does not exist in the current context" was thrown.
So, how can I do that?
Attachments
Screenshot_21.png
Screenshot_21.png (31.72 KiB) Viewed 2079 times
lamthanha
Posts: 9
Joined: Thu Dec 20, 2018 8:34 am

Re: Passing Guid as parameter to a sub-report does not work

Post by lamthanha »

My test data structure is very simple.
TestData contains a list of Parent records (report.RegData("TestData", parents)).
Attachments
Screenshot_22.png
Screenshot_22.png (37.79 KiB) Viewed 2079 times
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: Passing Guid as parameter to a sub-report does not work

Post by Lech Kulikowski »

Hello,

It is not possible to use Next() function in SubReport parameters. As a way, you can use an additional variable in which store Next() function result and use as SubReport parameter.

Thank you.
Post Reply