Thursday, February 07, 2013 1:07 PM
could somebody please provide an example of Custom Code which exports to PDF on the following way:
- upon click on PDF export button, it is necessary to filter rows based on the conditions i.e. value in two (2) columns and, consequently, to create following:
1) firstly, parent folder e.g., State_Name (i.e., value in the column 1)
2) within that folder should be listed all pdf files filtered based on the e.g. city names that belong to that state (i.e., value in the column 2)?
Can please somebody provide code skeleton that performs this or similar task within SSRS?
- Edited by daredavil3011 Thursday, February 07, 2013 1:09 PM
Monday, February 11, 2013 8:45 AMFrom your description, you want to filter data base on some conditions when export to PDF, right? In Reporting Services, we can use the RenderFormatName build-in function to filter data when exporting report. You can set the visibility of the report items using the expression:
- Proposed As Answer by Charlie LiaoMicrosoft Contingent Staff, Moderator Monday, February 11, 2013 9:58 AM
Tuesday, February 12, 2013 9:07 AM
Set rstR = New ADODB.Recordset Set rstR.ActiveConnection = conR rstR.Source = "tblToPrint" rstR.Open While Not rstR.EOF DoCmd.OpenReport "rptReportName", , , " [tblContent(first name, last name etc...)].Value='" & rstR("Value(from tblToPrint)") & "'" If fileManage.FolderExists("C:\PDF\") = False Then fileManage.CreateFolder ("C:\PDF\") End If If fileManage.FolderExists("C:\PDF\" & rstR("Value(from tblToPrint")) = False Then fileManage.CreateFolder ("C:\PDF\" & rstR("Value(from tblToPrint ")) End If fileManage.CopyFile "C:\PDF\ Value(from tblToPrint ).pdf", "C:\PDF\" & rstR("Value(from tblToPrint ") & "\" & rstR("Value(from tblToPrint ") & ".pdf", True fileManage.DeleteFile "C:\PDF\ Value(from tblToPrint ).*" rstR.MoveNext Wend rstR.Close conR.Close End Sub Result looks like this: PDF (parent folder) Value_1 (subfolder_1) Value_1.pdf (list of first name, family name, etc...) Value_2 (subfolder_2) Value_2.pdf (list of first name, family name, etc...) Value_3 (subfolder_3) Value_3.pdf (list of first name, family name, etc...) Etc...Etc...
I have attached ACCESS VB code that performs task I try to re-design in SSRS 2008. To save your time, have on mind that this VB code is practically one line program i.e., based on the parameter value from tblToPrint, this line extracts data from the related table named tblContent and, saves it in the folder structure as provided above !
That is all...Please, if you believe that built-in function RenderFormatName etc can be useful, please how to implement it? Where to find it (under expressions I can not see it..)
P.S. I have actually found it under built-in fields but, please, can you provide an example on real data?
- Edited by daredavil3011 Tuesday, February 12, 2013 1:45 PM