Passing Guid as parameter to a sub-report does not work
Posted: Thu Apr 18, 2019 5:05 am
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.
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.