How to Define Unstructured Data

SQL records are output without any body content.

You can write scripts to define unstructured data based on the values in your SQL result set.

  1. Navigate to Content Sources > SQL Content.
  2. Click > Edit.
  3. On the Edit Database content page that appears select Item Definition > Unstructured Data Options.
  4. Leave the default setting or make a selection:


  5. Click Define by script.
  6. Pick column (optional): Click to select the metadata column.
    Enter the following script into the scripting text box:

    Copy
    dim data as string = "TEST FILE:"
    dim meta1 as string = Host.GetStringValue("meta1")
    dim meta2 as string = Host.GetStringValue("meta2")
    data = data + " meta1 is:" + meta1
    data = data + " meta2 is:" + meta2
    dim extension as string = "txt"
    dim newFilePath as string = Host.GetTempFilePath(extension)
    Host.SetFileExtension(extension)
    File.WriteAllText(newFilePath,data)
    return newFilePath
  7. Click the Compile button.

Preserve Original file Content when writing Unstructured Data

  1. Navigate to Content Sources > WebService Content.
  2. Click > Edit.
  3. On the Edit Database content page that appears select Item Definition > Unstructured Data Options > File(create Zip)
  4. Click Define by script
  5. Add the following code snippet to your script to ensure original file content is saved in the zip file:

    Code snippet

  6. Copy
    dim initialContent= HOST.GetFileContent()
    if initialContent.length > 0
         dim title= HOST.GetID()
         Host.AddBlob(initialContent,name)
    end if
  7. Click Compile.