You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

This guide walks you through configuring the Reports module to generate PDF/text reports and exchange data with external systems. You'll create report forms with real-time data, configure web data exchanges, and schedule automatic generation.

Prerequisites:

  • Tags configured on UNS
  • Understanding of report requirements
  • External API details (if using WebData get/post)
On this Page:





Configuration Workflow

  1. Create Report Forms - Design PDF/text report layouts
  2. Configure WebData - Setup JSON/XML data exchange
  3. Add Dynamic Content - Insert tags, tables, charts
  4. Schedule Generation - Automate report creation
  5. Test and Deploy - Verify output and distribution

Step 1: Create Report Forms

Creating a New Form

  1. Navigate to Reports → Forms
  2. Click first row to add new form
  3. Configure properties:
PropertyDescriptionExample
NameForm identifierDailyProductionReport
SaveFormatOutput typePDF, Text, HTML
SaveFileNameFile pathC:\Reports\Daily_{{Tag.Date}}.pdf
SaveTriggerWhen to generateTag.GenerateReport
AppendAdd to existing file0=Replace, 1=Append

Form Editor Basics

  1. Go to Reports → Forms Editor
  2. Select form from dropdown
  3. Use editor like a word processor:
    • Format text with toolbar
    • Insert tags with {Tag.TagName}
    • Add tables and symbols

Step 2: Add Dynamic Content

Inserting Tags

Method 1: Direct Typing

Current Temperature: {Tag.Temperature} °C
Production Count: {Tag.ProductionCounter}
Operator: {Tag.OperatorName}

Method 2: Tag Browser

  1. Right-click toolbar Tag button
  2. Select tag from browser
  3. Tag inserted at cursor position

Adding Tables

Static Tables (Fixed rows):

  1. Click Table button in toolbar
  2. Select rows and columns
  3. Manually populate cells with tags

Dynamic Tables (Database queries):

Header Row: Column names for report
Data Row: {Dataset.Query.ProductionData}

Example dynamic table setup:

Report ColumnDatabase Column
Product NameProductName
Quantity{Tag.Quantity}
QualityQualityScore

Including Charts

  1. Create TrendChart in Displays
  2. Right-click chart → Make New Symbol
  3. In Forms Editor, click Symbol button
  4. Select your trend symbol

Step 3: Configure WebData

Setting Up Data Exchange

  1. Go to Reports → WebData
  2. Click Plus to add new WebData
  3. Configure:
PropertyDescriptionExample
NameWebData identifierProductionAPI
EncodingData formatJSON, XML, HTML
DefaultURLAPI endpointhttps://api.example.com/data
AuthorizationAuth typeBearer Token, Basic Auth

WebData Editor

  1. Navigate to Reports → WebData Editor
  2. Define data structure with tag bindings:

JSON Example:

json

{
  "timestamp": "{Tag.CurrentTime}",
  "production": {
    "line": "{Tag.ProductionLine}",
    "count": {Tag.ProductionCount},
    "quality": {Tag.QualityScore}
  }
}

API Operations

GET Request:

csharp

// Retrieve data from API
string response = await @Report.WebData.ProductionAPI.GetRequestAsync();
@Tag.APIResponse = response;

POST Request:

csharp

// Send data to API
// Body configured in WebData Editor
await @Report.WebData.ProductionAPI.PostRequestAsync();

Step 4: Generate Reports

Manual Generation

From Scripts:

csharp

// Save report to file
@Report.Form.DailyReport.Save();

// Generate with custom filename
@Report.Form.DailyReport.SaveAs("CustomReport.pdf");

Automatic Generation

Using SaveTrigger:

  1. Set SaveTrigger property to a tag
  2. When tag changes to 1, report generates
  3. Reset tag to 0 for next trigger

Scheduled Generation

csharp

// In startup script
@Report.Form.DailyReport.SaveTrigger = @Tag.DailyTrigger;

// In scheduled script (runs daily at 6 AM)
@Tag.DailyTrigger = 1;
@Tag.DailyTrigger = 0;

Step 5: Display Reports

PDF Viewer Control

  1. In Displays → Draw
  2. Add PdfViewer control
  3. Set properties:
    • FileName: Path to PDF
    • AutoRefresh: Update on file change

Report Viewer Control

For rich text reports:

  1. Add ReportViewer control
  2. Set ReportName property
  3. Displays formatted report content

Advanced Features

Headers and Footers

  1. Create separate forms for header/footer
  2. In main report, set:
    • Header: HeaderForm name
    • Footer: FooterForm name
  3. Content repeats on all pages

Multi-Language Support

csharp

// Switch language before generation
@Client.Localization = "Spanish";
@Report.Form.DailyReport.Save();

Custom Table Formatting

Use callback function for dynamic formatting:

csharp

public void OnReportCustomTableCell(string reportName, 
    string columnName, DataRow row, TableCell cell)
{
    if(Convert.ToDouble(row["Value"]) > 100)
    {
        cell.Background = Brushes.Red;
    }
}

Email Distribution

csharp

// After report generation
@Script.Email.SendReport(
    "recipient@example.com",
    "Daily Report",
    @Report.Form.DailyReport.SaveFileName
);

Common Issues

Report Not Generating

  • Verify SaveTrigger tag changes
  • Check file path permissions
  • Confirm tags have values
  • Review SaveFormat setting

Missing Data in Report

  • Verify tag syntax {Tag.Name}
  • Check tag quality/communication
  • Ensure queries execute before save
  • Test tags in Watch window

PDF Layout Issues

  • Adjust table column widths
  • Check symbol sizes
  • Use page breaks appropriately
  • Test different paper sizes

WebData Connection Failed

  • Verify URL and credentials
  • Check firewall settings
  • Test API in external tool
  • Review authorization headers

Best Practices

? Use meaningful names - Clear identification for forms and WebData ? Test tag values - Verify data before generation ? Handle errors - Check file write permissions ? Version control - Include timestamps in filenames ? Optimize queries - Run database queries before report generation ? Document templates - Maintain template library ? Schedule wisely - Generate during low-activity periods


Integration Examples

Production Report Workflow

  1. Collect data throughout shift
  2. Calculate KPIs at shift end
  3. Generate PDF report
  4. Email to management
  5. Archive to network drive

API Data Exchange

  1. Configure WebData for REST API
  2. Schedule periodic POST of metrics
  3. Receive configuration updates via GET
  4. Update tags with new setpoints

Next Steps

  • [PdfViewer Control →] Display generated reports
  • [Scripts Module →] Automate report workflows
  • [Email Notifications →] Distribute reports



In this section...

The root page @parent could not be found in space 93Draft.



  • No labels