Extract

Extracts data into a text file. The file will be created on the application server.

Tip:

You can extract files onto client PCs with the HsvcDataLoad type library. This library also offers properties and methods that simplify handling of the data extract options. For more information, see Extracting Data.

Syntax

<HsvData>.Extract bstrServerFileName, bstrLogFileName, varavSettings

Argument

Description

bstrServerFileName

String (ByVal). The name and path of the data extract file. The path must exist on the application server.

bstrLogFileName

String (ByVal). The name and path of the log file. The path must exist on the application server.

varavSettings

Variant array (ByVal). The extract options for the data extraction operation. The array is 1-based and contains 20 items. For details on valid indexes and values, see Table 60.

Tip:

Use EnumExtractOptions to return information about the valid extract options.

In this array you must specify member IDs for the Scenario, Year, Period, Entity, and Account extract options — these options are set in array items 7 through 12. You can use the defaults returned by EnumExtractOptions for the other options.

The following table describes the data extract options. Some of the valid values are represented by constants of the HsvcDataLoad type library. To use these constants, you must reference HsvcDataLoad in your project; for information on this library, see HsvcDataLoad Type Library.

The listed indexes apply to the array passed to Extract and to the first dimension of the array returned by EnumExtractOptions.

Table 60. Data Extract Options

Index

Extract Option Information

1

Option: View

Usage: Specifies the View dimension member for which data is being extracted.

Pass to Extract: One of the following HsvcDataLoad type library constants:

  • HSV_DATA_VIEW_PERIODIC. Data for the Periodic view will be extracted.

  • HSV_DATA_VIEW_YTD. Data for the year-to-date view will be extracted.

  • HSV_DATA_VIEW_SCENARIO. Data for the scenario’s default View dimension member will be extracted.

    Tip:

    These constants correspond to the Data View option buttons in the Extract Data workspace frame.

2

Option: Delimiter

Usage: Specifies an extract file’s delimiter.

Pass to Extract: A valid delimiter character (String subtype).

3

Option: Log file name.

For internal use.

4

Option: Append to Log File

Usage: Specifies whether log data is appended to or overwrites the existing log file.

Pass to Extract: TRUE to append, FALSE to overwrite.

5

Option: Append to Extract File

For internal use.

6

Option: Extract Calculated

Usage: Specifies whether to extract calculated data.

Pass to Extract: TRUE to extract calculated data, FALSE otherwise.

7

Option: Scenario

Usage: Specifies the Scenario dimension member for which data is being extracted.

Pass to Extract: A Long containing the Scenario member’s ID.

8

Option: Year

Usage: Specifies the Year dimension member for which data is being extracted.

Pass to Extract: A Long containing the Year member’s ID.

9

Option: Period Subset

Usage: Specifies the Period dimension members for which data is being extracted.

Pass to Extract: A Long array containing Period member IDs.

10

Option: Entity Subset

Usage: Specifies the child Entity dimension members for which data is being extracted.

Pass to Extract: A Long array containing Entity member IDs.

11

Option: Parent Subset

Usage: Specifies the parent Entity dimension members for which data is being extracted.

Pass to Extract: A Long array containing Entity dimension IDs.

12

Option: Account Subset

Usage: Specifies the Account dimension members for which data is being extracted.

Pass to Extract: A Long array containing Account member IDs.

13

Option: ICP Subset

For internal use.

14

Option: Value Subset

For internal use.

15

Option: Custom 1 Subset

For internal use.

16

Option: Custom 2 Subset

For internal use.

17

Option: Custom 3 Subset

For internal use.

18

Option: Custom 4 Subset

For internal use.

19

Option: Extract All Data

For internal use.

20

Option: Unicode

For internal use.

Example

The following example extracts data for the dimension members listed below:

The custom function getDataExtractDefaults assigns the default extract options to the vaSettings array. The IDs of the dimension members listed above are obtained with the custom function GetMemberID, then assigned to the vaSettings array; this overrides the previously assigned default values for vaSettings items 7 through 12. vaSettings is then passed to Extract.

Tip:

For details on the getDataExtractDefaults custom function, see the Example for EnumExtractOptions. For details on the GetMemberID custom function, see the Examples for IHsvTreeInfo.GetItemID.

Dim vaSettings, lScen As Long, lYear As Long, laPer(2) As Long
Dim laAcct(0) As Long, laPar(0) As Long, laEnt(0) As Long
'Get the default extract options
vaSettings = getDataExtractDefaults()
'Set the scenario and year
vaSettings(7) = GetMemberID(DIMENSIONSCENARIO, "Actual")
vaSettings(8) = GetMemberID(DIMENSIONYEAR, "2000")
'Set the periods
laPer(0) = GetMemberID(DIMENSIONPERIOD, "July")
laPer(1) = GetMemberID(DIMENSIONPERIOD, "August")
laPer(2) = GetMemberID(DIMENSIONPERIOD, "September")
vaSettings(9) = laPer
'Set the child and parent entities
laEnt(0) = GetMemberID(DIMENSIONENTITY, "Connecticut")
vaSettings(10) = laEnt
laPar(0) = GetMemberID(DIMENSIONENTITY, "UnitedStates")
vaSettings(11) = laPar
'Set the account
laAcct(0) = GetMemberID(DIMENSIONACCOUNT, "Sales")
vaSettings(12) = laAcct
'Extract the data
m_cHsvData.Extract "c:\Acme\myAppExt.dat", _ 
"c:\Acme\myAppExt.log", vaSettings