CxExport Methods

The following methods are available for interfacing with the CxDynagraph.CxExport object:

For information about other methods not specific to CxDynagraph.CxExport, including additional export methods, see CxDynagraph Methods.

CancelExport

The CancelExport method enables you to define how many seconds to wait before canceling the export.

Syntax

CancelExport(iSecondsToWait As Long) As Boolean

Parameters

Parameter Required Description

iSecondsToWait

Yes

Defines the maximum number of seconds to wait before canceling the export.

Back to top

GetStatus

Syntax

GetStatus() As String

Back to top

IsExportRunning

Syntax

IsExportRunning() As Boolean

Back to top

StartExport

The StartExport method defines the export of the specified set of dynagraph cards upon a defined event.

Syntax

StartExport(UisOrDdsSiteService As String, Filter As String, CardTypes As Integer, SurfaceCard As Boolean, DateTime As String, ExportFormat As Integer, FileSpecifier As String, StatusTag As String) As Boolean

Parameters

Parameter Required Description

UisOrDdsSiteService

Yes

The UisOrDdsSiteService method defines the relevant UIS or DDS site and service in "Site.Service" format. For example, TEST.UIS.

Filter

Yes

Identifies a set of devices to export. Only pumpoff control devices can be included.

Note:Setting a device filter to DEVICE_ENABLED=Y yields a list of all enabled pumpoff control devices. Setting a device filter to DEVICE_TYPE=LUFKINSAM yields a list of all Lufkin SAM devices. Setting a device filter to FACILITY_ID=SAM_TEST yields the one facility with Facility ID SAM_TEST.

CardTypes

Yes

Identifies a set of card types to export.

Cards are identified by the following numeric constants:

  • Current = 1
  • Shutdown = 2
  • Pump-up = 4
  • Reference = 8
  • Start = 16

To export both shutdown and pump-up cards, set to 6 (shutdown (2) + pumpup (4) = 6).

SurfaceCard

Yes

Indicates if a card is a surface card (true) or a downhole card (false).

Currently, the only export format valid for downhole cards is .csv.

DateTime

Yes

Represents the earliest card time (DDS transaction timestamp) to export.

It can be an absolute time (for instance, 1/14/2024) or relative time (for instance, t-1 = yesterday).

If left blank, the single most recently retrieved card is exported. Otherwise, all cards retrieved on or after this time are exported.

ExportFormat

Yes

Indicates the export file format.

File formats are identified by the following numeric constants:

  • .csv = 1
  • Lufkin DIAG = 2
  • Theta = 3

FileSpecifier

Yes

Specifies the folder (or file) in which to store the relevant export files.

If no file name is specified, the default file name is FacilityId_DateTime.filename, where .filename is the file extension specific to the export format.

Keyword substitution is provided for facility ID, date, sequence number, card type, and file extension.

For example, a default file name can be represented as "%fac%_%date%.%ext%".

A file specifier of "c:\DynaExport\%fac%_%date%\Current%seq%.%ext%" puts the cards for each facility and date into a different folder. For instance, c:\DynaExport\FAC1_2023-09-30\Current0.DAT.

The following are all of the format specifiers available:

  • %fac% = facility ID
  • %date% = transaction date time in the format YYYY-MM-DD-HHMMSS.mmm
  • %seq% = sequence number to distinguish cards
  • %card% = card type (C=current, S=shutdown, P=pumpup, R=reference, T=start, I=ideal)
  • %ext% = file extension for selected export format

Additional formatting is available for dates and sequence numbers; the nomenclature is the same as on CygNet Studio screens.

For example "%date[yyyy-mmm-dd]%" results in the a date formatted as 2023-Sep-30.

Sequence number formatting can be used to zero pad numbers. For example, "%seq[000]%" results in a 3-digit sequence number.

StatusTag

Yes

Writes export status to a fully qualified tag. Upon successful export, this value indicates the number of facilities and number of cards exported.

Leave blank to omit recording to a status tag.

Back to top

CxDynagraph.CxExport Example

The following is a simple example.

Copy
CxDynagraph.CxExport
On Error Resume Next
Dim gDynaExp
Set gDynaExp = CreateObject("CxDynagraph.CxExport")
If err.number <> 0 Then
    MsgBox "Unable to create object"
    Exit Sub
End If
 
' UisOrDdsSiteService
' Filter
' CardTypes 1=current; 2=shutdown; 4=pumpup; 8=reference; 16=start
' SurfaceCard
' DateTime (blank = most recent card)
' ExportFormat: 1=csv; 2=diag; 3=theta
' FileSpecifier
' StatusTag (blank = none)
 
gDynaExp.StartExport  "SEK.UIS", "DEVICE_ID=SAM45", 1, True, "May 2, 2023 13:34", 2, "d:\CygNet\ExportFiles", "SEK.UIS:SAM45_EXP_STATUS"
 
' wait for thread to complete before exiting;
' because of local object (gDynaExp) declaration in this example
' the dynagraph object is destroyed when the function exits
 
While gDynaExp.IsExportRunning()
    wscript.sleep(100)    ' wait in milliseconds
Wend
 
'In an HSS script, call CygNetScriptHost.Sleep(100) instead of wscript.sleep(100). The CygNetScriptHost.Sleep() function returns false if the HSS is in the midst of shutting down.
 
bShutdown = false
While gDynaExp.IsExportRunning() and not bShutdown
    bShutdown = CygNetScriptHost.Sleep(100) ' wait in milliseconds
Wend

 

Note: This example uses the WScript.Sleep statement, which is not available for use when scripting in CygNet Studio. Use TheView's EventTimer instead.

Back to top