Export2ASCII

Modified on 2013/05/11 11:02 by Eugene — Categorized as: Community Components

Syntax

public static void Export2ASCII(this WealthScript obj, string path) public static void Export2ASCII(this WealthScript obj, string path, string extension) public static void Export2ASCII(this WealthScript obj, string path, string extension, string customDateFormat)

public void Export2ASCII(string path) public void Export2ASCII(string path, string extension) public void Export2ASCII(string path, string extension, string customDateFormat)


Parameter Description

pathThe path to export directory ending with a backslash ("\")
extension(optional) File extension e.g. csv, txt, asc
customDateFormat(optional) Custom DateTime format (see below)

Description

Exports data to ASCII comma-separated files. Sample data string:

07/31/2009,162.99,165,162.91,163.39,15090600

Example

Example using C# extension methods:

using System; using System.Collections.Generic; using System.Text; using WealthLab;

public class Export2ASCII_demo : WealthScript { protected override void Execute() { string path = @"C:\Data\ASCII\"; this.Export2ASCII( path ); } }


Legacy syntax example:

using System; using System.Collections.Generic; using System.Text; using WealthLab; using Community.Components;

public class Export2ASCII_demo : WealthScript { protected override void Execute() { Utility u = new Utility( this ); string path = @"C:\Data\ASCII\"; u.Export2ASCII( path ); } }


Getting dates formatted in a custom way

To create the Date/Time in one of the standard formats (or in a custom one), specify an optional Custom DateFormat by passing its string as one of the method's parameters. Format examples can be found on Microsoft's site:


Standard DateTime Format Strings
Custom DateTime Format Strings