Jump to content

Spotfire Prepared Reports


Go to solution Solved by apreble,

Recommended Posts

Posted

Good afternoon, 

Hoping to find some help or suggestions for an issue of mine with the prepared reports... we have a few metrics that we are calculating on a monthly basis and we have these metrics spread out over 6 tabs for PDF reporting, but this isn't utilizing space very efficiently (We also can't put all these charts on 1 or 2 tabs- it's just too much and hard to keep track of). This specific metric is a Foot per Hour measurement, but just at different category intervals (Think of these categories like "Starting FPH", "Halfway FPH", "Ending FPH"). We have tried to incorporate the metrics as a stored Document Property drop-down box option that makes it easy for us to toggle back and forth between the metrics on the Y-Axis of the bar charts to make it a 1-tab metric (X-axis is just a category type), however, we need to make this to where the prepared report can generate each metric category on a PDF report based on all metric options in this document property on the 1-tab. I'm not sure if this function exists yet or if we need to continue to leave these metrics on their own pages. Maybe there are other ideas that we aren't considering? Any thoughts and/or suggestions would be greatly appreciated! 

Metric #1

image.thumb.png.55b001d31aec6299bc26f3b2f1983eda.png

Metric #2

image.thumb.png.cc0c463bc9efcdb424c1cbba03b52938.png

There are 7 total metric categories, but this is the idea. Same graphs, same trellis, just different y-axis FPH metric categories. 

Posted

Hi @apreble

Your design and assumptions are correct. Indeed you can create a document property Metric containing your calculation expressions and use a property control to set the metric dynamic on a single page

image.thumb.png.05a91cf11dc2de5235541c7efa727b0f.png

Once you've done this you will create an action control (a button) to loop into the value and export the PDF.

The below code is just changing my x-axis and exporting in PDF. The current limitation is that we cannot export on a single PDF file. Maybe you can find some Python library to combine the resulting PDF into a single. 

# Import namespaces
from Spotfire.Dxp.Framework.ApplicationModel import ApplicationThread
from Spotfire.Dxp.Application.Export import PdfExportSettings
from Spotfire.Dxp.Application.Export import ExportScope
from Spotfire.Dxp.Application.Export import PageOrientation
from Spotfire.Dxp.Application.Export import PaperSize
from Spotfire.Dxp.Application.Export import ExportScope


# Assuming you have an array of strings
string_array = ["Factory", "City"]

prop_name = "MetricToDisplay"

# Get the document property manager
property_manager = Document.Properties

# Loop through the array of strings and set each as a document property
for prop_value in string_array:
    # Set the value of the document property (you can change the value as needed)
    property_manager[prop_name] = prop_value

    fileName = "C:\\temp\\exported_" + prop_value + ".pdf"
    pdfexpsettings = PdfExportSettings()
    pdfexpsettings.Scope = ExportScope.ActivePage
    pdfexpsettings.PageOrientation = PageOrientation.Landscape
    pdfexpsettings.IncludePageTitles = False
    pdfexpsettings.IncludeVisualizationTitles = False
    pdfexpsettings.IncludeVisualizationDescriptions = False
    pdfexpsettings.PaperSize = PaperSize.A4
    pdfexpsettings.PageOrientation = PageOrientation.Landscape

    #exporting ...
    Application.GetService[ApplicationThread]().InvokeAsynchronously(g(Application, fileName,pdfexpsettings))

 

I hope this will put you in the right direction

  • Solution
Posted

@Olivier Keugue Tadaa Thank you for assisting w/the document properties help, but was needing the document property to be repeated over in the prepared report setting. 

I think I was able to find a solution utilizing the bookmark repeat over function. I created my document property as 7 unique custom expressions, all with their distinct titles. From there, I set the Y-Axis on my combo charts to the document property and created a Text Area on the side. The Text Area holds the drop-down option and when you make your selection, I saved the visual multiple times with the changing drop down options as a bookmark. From there, I went to the prepared reports and added my visual to the report and selected the repeat over function and the 7 bookmarks were available to all be selected. I'm hoping that this will work with time as it goes (hopefully not just a capture of today).  

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...