Seal Report Forum
»
Report Edition
»
Reports
»
Pass multiple restriction to sub report
Rank: Newbie
Groups: Registered
Joined: 3/17/2017(UTC) Posts: 6 Location: India Thanks: 4 times Was thanked: 1 time(s) in 1 post(s)
|
How to pass multiple restriction from parent report to sub report I.e If we want to get sub report of a specific month based on the auto generated month column of date column than how to do it?
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
In a sub-report, you can defined several restrictions but set the property: 'Prompt as execution', then it is better that all the restrictions should normally come from the same table definition... Using Sub-Report may require particular context, you have really to test them in real condition. Good luck.
|
2 users thanked epf for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/3/2018(UTC) Posts: 33 Thanks: 13 times
|
Hi epf, I have a Main report which uses tables 'WO' & 'WOLabor' and contains restriction on both tables(WO.Type & WOLabor.WorkDate).Then there is a subreport which has (WO.Type & WOLabor.WorkDate) as "Promp at Execution". The subreport is applied to WOLabor.WorkDate and in server manager it prompts that "1" restriction is added !!! It seems only restrictions that are on the same table as the subreport column are applied.So when I click the WOLabor.WorkDate column in my main report , the subreport is executed with only WOLabor.WorkDate restriction and WO.Type values are not sent to the subreport . Is there anyway to pass restrictions on other table than the subreport column to it? Thanks Edited by user Monday, December 3, 2018 7:17:07 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Yes,when you add a sub-reports from the Server Manager, it takes only the restrictions from the parent table. However you might edit directly the XML (.scfx) file by adding the restrictions guid got from your sub-report (*.srex) <Restrictions> <string>d937c8fc-64a6-415f-a77f-d3d1914e406d</string> <string>20ed0b7a-87dd-4aaa-8d48-feab848e396b</string> </Restrictions> As it is a list of string. It seems to work. The guid is got from <MetaColumnGUID>20ed0b7a-87dd-4aaa-8d48-feab848e396b</MetaColumnGUID>
This should be enhanced...
Otherwise, I would recommend to create a view above that makes the join and to create a key column with your date and type...if it fits your requirement.
|
1 user thanked epf for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/3/2018(UTC) Posts: 33 Thanks: 13 times
|
Thanks epf, works fine now. there is just a liitle problem, if I have a restriction in my main report that has multiple values e.g "WO.ShopID IN ('FSSC1','FSSC2')", Only the First value (FSSC1) is passed to the subreport.Any solution for that? Thanks Again.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Normally, you call a sub-report from a cell which has a single value, so for me it is not possible to pass multiple values for the same column in a sub-report context, can you explain more your problem ?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/3/2018(UTC) Posts: 33 Thanks: 13 times
|
Suppose that we have a table called 'WO' and the columns are 'WOID,ShopID,Month'. I have a report that shows me how many 'WOID's are in each 'Month'. The restriction in this report is "WO.ShopID IN ('FSSC1','FSSC2')". The sub-report is based on the 'Month' column. So I'm actually calling the sub-report from a cell which has a single value too. But the problem is that I need the restriction (WO.ShopID IN ('FSSC1','FSSC2')) to be passed to the sub-report too. But only the first value(FSSC1) is passed.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
I have to check this case...if it it incorrect, the fix would be for the next release...
|
1 user thanked epf for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/3/2018(UTC) Posts: 33 Thanks: 13 times
|
Originally Posted by: epf I have to check this case...if it it incorrect, the fix would be for the next release... Hi epf, Did you get any chance to check that? Thanks
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
well, it is in the TODO list, but we actually give the priority to sponsored features...so no planning so far. Sorry.
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 2/1/2019(UTC) Posts: 4
|
Not sure if you've already solved this, but with a bit of customization you can do this (in the 'Final Script' section They way i ended up doing it was to total re-draw the report HTML, then add a custom link to the cells in question.
It requires getting the MetaGUID of the columns in the sub-report (open the report file with a text editor to see this).
Don't setup the reports as a sub-report like you normally would
On the cell you want
// create a new link NavigationLink link = new NavigationLink();
// this is the main part string hrefString = "rpa=%25SEALREPOSITORY%25%5cSubReports%5c" + <subReportName> + "&dis=" + <value of the cell where sub-report starts> + "";
Then you need to add each restriction and value to the end of the URL with &res=<the METAID of the field in the subreport>&val = <the values you are passing in> you will also need a counter as its &res1=something&val=something&res2=somethingelse&val=somethingelse&res3... etc
Then at the end do this link.Href = hrefString; link.Text = "<name you want to see in the popup"; <cell you want the link on>.Links.Add(link);
hope it works for you
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/3/2018(UTC) Posts: 33 Thanks: 13 times
|
Originally Posted by: Alex Keil Not sure if you've already solved this, but with a bit of customization you can do this (in the 'Final Script' section They way i ended up doing it was to total re-draw the report HTML, then add a custom link to the cells in question.
It requires getting the MetaGUID of the columns in the sub-report (open the report file with a text editor to see this).
Don't setup the reports as a sub-report like you normally would
On the cell you want
// create a new link NavigationLink link = new NavigationLink();
// this is the main part string hrefString = "rpa=%25SEALREPOSITORY%25%5cSubReports%5c" + <subReportName> + "&dis=" + <value of the cell where sub-report starts> + "";
Then you need to add each restriction and value to the end of the URL with &res=<the METAID of the field in the subreport>&val = <the values you are passing in> you will also need a counter as its &res1=something&val=something&res2=somethingelse&val=somethingelse&res3... etc
Then at the end do this link.Href = hrefString; link.Text = "<name you want to see in the popup"; <cell you want the link on>.Links.Add(link);
hope it works for you
Hi Alex,I'll check out your solution Thanks man
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
I am glad to see that you may control everything in the final script...
I made a small modification for the incoming 5.0, sub-reports may contain restrictions from columns coming from other tables, I hope it will be enough for your needs. If you make a sample with Northwind (reports + data source), I can check it.
|
1 user thanked epf for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/3/2018(UTC) Posts: 33 Thanks: 13 times
|
Originally Posted by: Alex Keil Not sure if you've already solved this, but with a bit of customization you can do this (in the 'Final Script' section They way i ended up doing it was to total re-draw the report HTML, then add a custom link to the cells in question.
It requires getting the MetaGUID of the columns in the sub-report (open the report file with a text editor to see this).
Don't setup the reports as a sub-report like you normally would
On the cell you want
// create a new link NavigationLink link = new NavigationLink();
// this is the main part string hrefString = "rpa=%25SEALREPOSITORY%25%5cSubReports%5c" + <subReportName> + "&dis=" + <value of the cell where sub-report starts> + "";
Then you need to add each restriction and value to the end of the URL with &res=<the METAID of the field in the subreport>&val = <the values you are passing in> you will also need a counter as its &res1=something&val=something&res2=somethingelse&val=somethingelse&res3... etc
Then at the end do this link.Href = hrefString; link.Text = "<name you want to see in the popup"; <cell you want the link on>.Links.Add(link);
hope it works for you
Hi Alex, I Couldn't get it working. Could you please make a sample with Northwind? And by the way does this solution work with restriction that are prompted and the user select a combination of them? Or is it just a fixed set of restriction sent to the subreport? Thanks
|
|
|
|
Seal Report Forum
»
Report Edition
»
Reports
»
Pass multiple restriction to sub report
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.