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

Compare with Current View Page History

« Previous Version 4 Next »

Disclamer

The sample scripts provided on this page are for the purpose of demonstrating the features of RED and are not considered production ready, please use these scripts at your own risk and adjust them to suit your own environment as required.

Export Objects - Metadata, Create DDL, Scripts, Procedures and Templates

This example script will combine the Workflow Script feature with the command line tooling of RED to output metadata to a flat file structure useful for GIT integration, here are the steps performed:

  • Create an output directory structure that represents the Object Tree in RED
  • Run WslMetadataService.exe and extract each Object's metadata to a json file with a .metadata extension
  • Run a RedCli batch script that outputs:
    • Procedure, Script and Template files for each Object in the Context
    • Generates and outputs Create DDL as .ddl files for each Object in the Context 

There are two Scripts involved:

  1. 'Export Objects' Workflow Script - This is a wrapper to execute the main script in a separate thread so that RED UI is not locked.
  2. 'wsl_workflow_export_objects_example' Powershell script

Script 1: 'Export Objects' Workflow Script

Create a new Host Script Language (HSL) of category 'Workflow' copied from the inbuilt Powershell (64-bit) HSL. Follow the user guide instructions on creating a Host Script Language of category 'Workflow'.

Create a new Host Script object in RED, name it 'Export Objects', assign the script type as the Powershell Workflow HSL you created earlier.

Enter the following code into the Host Script 'Export Objects':

Export Objects - Workflow Powershell wrapper script
Write-Output 1
Write-Output "Export Objects operation started - You can monitor progress via the separate Powershell window"
Write-Output "NOTE: You can close the separate Powershell window once the process completes, it is left open to display the result only."
Write-Output "Logs are located in the work directory of the script and have a sequence ID of $


  • No labels