CabMasterPro User Guide
In This Topic
    Reports : Developer
    In This Topic

    CabMaster RDL reports are always run with the "current directory" as the Report folder. CabMaster generates the required data (as an MDB in .\TempReportData) and all required images (as png's in a subtree, e.g. .\TempReportData\OrthoImages\2.png etc).

    The Microsoft Report View control does not support relative paths, so we must prepend the "current directory" in the report designer for the reports to run correctly. Even the MDB path needs to be found as a relative path, but this is fully handled by the AMS RDLViewer.exe.

    Looking at the RDLViewer.exe Command Line via UserTrace

    CabMaster registry option UserTrace provides a bitmask enabling various tracing information to be sent to a trace file in the ProgramFolder. The trace bit 3 (hex 0x08) outputs the RDL reporting arguments list.

    RDLViewer.exe is called with a cmd line after CabMaster has generated required image tree plus the filtered MDB database. The command line has the parameter values, so for debugging it is helpful to be able to see the actual cmd line params.

    In order to replicate the behaviour of CabMaster calling RDLViewer.exe, you need to CD to ensure the *current directory* is the Report folder, then fire up RDLViewer.exe with an appropriate path... typically Report is a subfolder of the ProgramFolder, which is where RDLViewer.exe lives, so a cmd line that would work in that case is...

    CD <ReportFolder> ..\RDLViewer.exe xxxxxxxx,
    where xxxxxxxx is the cmd line arg list that is output in the user tracing.

    For example:-

    ..\RDLViewer.exe -r "ShapeList.rdl" -p "JobRef=&JobNumber=theJobNumber&JobCust="

    is a cmd line to run ShapeList.rdl (always in the current folder) with a param list as shown. This param list will be generated by looking at the RDL to see which params are needed, then evaluating any drawing properties referred to as params.

    Note that the special RDL params AMSImages and AMSFilter are never handed on as part of the cmd line, but are used to set up the images subtree and the MDB, both of which can be inspected for debug purposes after attempting to run a report.

    Steps to Preparing a new RDL Report

    Step 1

    To run a report with images, you will need a "ReportPath" parameter. This can be empty, and whatever value it has will be updated to the true reportfolder path by RdlViewer.exe when it runs.

    The images need to use this "ReportPath" parameter, as shown below, and then the images will always be found when the report is run.

    Step 2

    Of course, you also need to ask CabMaster to generate the correct images as needed for your RDL report. You can choose the image type(s) and the resolution.

    Example: "Ortho=600,Plan=600"

    To do this you include an RDL parameter called AMSImages. See separate notes on that. [Note: the early sample RDL's have this as an XML comment, changed now to use a parameter.]

    You can add the AMSImages spec as you prepare the RDL file for shipment.

    There is also an AMSFilter parameter which optionally restricts/extends the data sent to the MDB. By default, CabMaster looks at the SQL statement in the report and generates all tables/fields that are referenced in the SQL. But you may want to provide additional tables/fields in the MDB data, particularly during report development so you can select from more fields. AMSFilter includes wildcard specs to let you do this.

    Step 3

    And when designing reports in the Microsoft Report Builder, you need to point to the Access database (MDB file) and it will put a full absolute path to it into the report. The other step needed to make the report available for general shipment is to make this path relative (ie ".\TempReportData\CabExportData.mdb"). The low level Microsoft control, as used in Report Builder, does not understand this relative path but RdlViewer.exe (using by CabMaster) does.

    Step 4

    With these steps done, you can ship a report by simply adding the RDL file to the ReportFolder. Select the report from within CabMaster and it should generate the required data and run the report in the RdlViewer automatically.

    If a report is not generating the expected results for an end user, you can always zip up the TempReportData subtree on their PC and unpack and run the report from the command line (as shown above) to investigate.

    Make sure you are running at least version 10.1.0.183 of CabMaster to generate correct data in the MDB

    Designing RDL Reports, generating sample dat

    In this discussion, we are using Microsoft Report Builder, ver 15.0.01473.0.

    To get suitable data for a new design, make any RDL report and add parameter AMSFilter with value *.* in the report. Then run the report with CabMaster and it will generate a full set of data for the current drawing. The "*.*" will make it include all fields available.

    You can also add a specific table in full, for example, "Component.*" adds all fields in the Component table.

    Once you complete the design and are ready to ship, remove any *.* or other wildcard filter parameters, and re-test. You will find the MDB file is much smaller as it will now only generate fields actually referenced in your specific report.

    Adding the ReportPath Parameter

    While designing the report, you must add a parameter by right clicking on "Parameters".

    Add a parameter with name ReportPath and then when using any image placemarker, rclick and set the image properties using the fx formula builder.


    Report 1

    You will need a formula like the one above. Depending on which images you are using, you'll need to get them from the right subfolder. In this case we are using OrthoImages and indexing them by the id field (Fields!id.Value) giving this full path formula...

    ="file:"&Parameters!ReportPath.Value&"\TempReportData\OrthoImages\"&cstr(Fields!id.Value)&".png"

    Be careful not to add extra spaces... these will stop it working. For example, starting the expression with "file: " instead of "file:" stops it working.

    You can easily test your generated report using RdlViewer from the command line, as discussed above.

    Using an RDL Report to silently Export CSVs

    RDLViewer.exe to support a param -s (for 'Silent' running) and in that case also use the additional param -o "outputfilefullpath"

    When silent running is required, the RDL report should be built with an extra parameter AMSExport with value as a middleware expression that will be evaluated ahead of calling RDLViewer.exe to determine the "outputfilefullpath". Note this means that if you want to hardcode a file path and name, you must put the string in quotes so it is a valid middleware string constant. Or you could use a drawing property variable name as your expression, or include it as part of an expression.

    If an invalid expression is supplied for the value of the AMSExport parameter, then the outputfilepath will be set (by CM) to AMSExport.csv in the DataFolder.

    The middleware can use formulas to generate paths that are in the DataFolder and so forth, as required.

    Reporting can be done either directly from the CM menus or via a middleware action Report command, it makes no difference.

    When running silently, RDLViewer.exe always generates the "Dataset to CSV" version of the csv data (and does so silently). It is then up to middleware etc to do any follow on processing.

    There is another optional parameter AMSExportNoHeaders. If present and evaluating to true, then the export csv file generated will have no header line, just the data lines.

    Report not generating expected results for end user

    If support is required for a report that is not generating the expected results for an end user, and the problem is thought to be in the report or RDLViewer, then after trying to run the report from CabMaster, you should send the following files to the support desk.

    1. Zip up the TempReportData subtree of the Report folder on the user PC

    2. Attach the RDL report to the email

    3. Copy the text in the usertrace output which shows the calling command line for RDLViewer. This should be obtained by running CabMaster and generating the report while registry trace options are set up with UserTraceMask set to 0x8.

    If the problem is in the generation of the reporting data, then it is useful to include...

    4. Zip of the test drawing QID that was used to generate the data.

    With this information, the support desk can reproduce the reporting behaviour by unpacking the zip and running the report from the command line (as shown below) to investigate.

    ..\RDLViewer.exe -r "ReportSample.rdl" -o "somepath"

    ...or similar, based on the actual command line obtained in step 3 above.

    Setting the Query Type

    When using a query, while setting up the report, the Query Type should be set to "Text" using this radio button:


    Report 2

    This works for both MDB table queries and also for queries using an ODBC text data source.

    There is no support currently for the other settings of this radio button, though some could be added if there is any limitation. But at this stage, setting to "Text" seems to work in all current reporting situations.

    Setting up Internal Parameters

    When adding parameters that are used internally for controlling the reporting process, we don't want the RDLViewer to also prompt for values of these parameters. It will prompt because they are valid parameters but are not handed over to RDLViewer directly. In this case it is important to set the options for these parameters correctly to ensure they can be used silently.

    For example, when adding the AMSExport parameter, it will initially look like the following and must be changed...

    To ensure no prompting happens for any internal parameter, change (1) to internal and (2) check "Allow blank value"


    Report 3