SaveReportSchema

You can use the SaveReportSchema function to save XSD schema data to a file on the configured Web Reports server and return the complete file path.

When to use

You can use this function to:

  • Save XSD schemas to the Web Reports server for report tools to validate XML data.
  • Provide schema definitions for report designers working with Optiva XML data.

When not to use

You cannot use this function:

  • When the schema needs to remain in memory for validation without creating a file.
  • In MT SaaS implementations.

Working

  1. Web.config Configuration

    Reads Web.config option to find the Web Reports server name:

    <add key="SvcReportServerName" value="<your server>" />

  2. File Location

    Saves the XSD file to this location on the configured Web Reports server:

    \\<ReportServerName>\Source\<tenantID>\<XSD file>

    Where:

    • ReportServerName: Configured in Web.config
    • tenantID: The name you see in the drop-down list of the Optiva Login page.
  3. File Name
    • The outfile parameter cannot contain any part of a path.
    • Must be the name of a file only.
    • The .xsd extension is automatically appended by Optiva.
Note: 
  • The outfile parameter must be a file name only, not a path.
  • The .xsd extension is automatically added by Optiva.

Syntax

string SaveReportSchema(string xml, string outfile);

Parameters

Parameter Type Required Description
xml string Yes The XML string data to save to a file.
outfile string Yes The output file name. This file name cannot contain any path - must be file name only. The .xsd extension is automatically appended by Optiva.

Return Value

The application returns the complete file path to the saved XSD file on the Web Reports server.

Returned path example

\\REPORTSERVER01\Source\PRODUCTION_TENANT\ITEM_RPT.XSD

Where:

  • REPORTSERVER01: Report server name from Web.config
  • Source: Fixed folder name
  • PRODUCTION_TENANT: Tenant ID
  • ITEM_RPT.XSD: File name
    Note: The .xsd extension is automatically added.

Prerequisites

The network access from the Optiva server to the Web Reports server is required.

SaveReportData vs SaveReportSchema

Feature SaveReportData SaveReportSchema
Purpose Save XML data. Save XSD schema.
File Location SessionXML folder. Source folder.
File Extension .xml (in file name). .xsd (auto-appended).
File Naming Auto-generated. User-specified.
Use Case Report data. Schema definition.

Examples

Example 1
Save Report xsd (schema) and Display File Path.
// Generate XSD schema for current object
string xsd = ObjectXsd("", "", "HEADER;TPALL");

// Save XSD to Web Reports server
string filePath = SaveReportSchema(xsd, "ITEM_RPT.XSD");

// Display the file path
MessageList(filePath);
Description

When you run the below Action:

  • A message is displayed with the path to the location of the generated xsd file.
  • The xsd file is written to the Report Server.