Profiler Object:Data Input: Difference between revisions

From Melissa Data Wiki
Jump to navigation Jump to search
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 2: Line 2:
[[Profiler Object:Reference|← Profiler Object Reference]]
[[Profiler Object:Reference|← Profiler Object Reference]]


{| class="mw-collapsible" cellspacing="2" style="background-color:#f9f9f9; border:1px solid #aaaaaa; font-size:9pt; color:#0645ad; padding:8px 8px;"
{{ProfilerObjectNav}}
! style="text-align:left; color:black; border-bottom:1px solid #aaaaaa;"|'''Profiler Object Interface Navigation'''
|-
| style="padding-right:220px;"|
|-
|[[Profiler Object:Initialization|Initialization]]
|-
|[[Profiler Object:Object Information|Object Information]]
|-
|[[Profiler Object:Enumeration Listing and Parsing|Enumeration Listing and Parsing]]
|-
|[[Profiler Object:Column Specification|Column Specification]]
|-
|[[Profiler Object:Initiate Profiling|Initiate Profiling]]
|-
|[[Profiler Object:Data Input|Data Input]]
|-
|[[Profiler Object:Profiling|Profiling]]
|-
|[[Profiler Object:Table-Based Statistics|Table-Based Statistics]]
|-
|-
|
{| class="mw-collapsible mw-collapsed" style="width:100%;"
|- align="left"
! style="color:black;"|[[Profiler Object:Column-Based Statistics|Column-Based Statistics]]
|-
|[[Profiler Object:Column-Based String Statistics|Column-Based String Statistics]]
|-
|[[Profiler Object:Column-Based Numeric Statistics|Column-Based Numeric Statistics]]
|-
|[[Profiler Object:Column-Based Date/Time Statistics|Column-Based Date/Time Statistics]]
|-
|[[Profiler Object:Column-Based Name Statistics|Column-Based Name Statistics]]
|-
|[[Profiler Object:Column-Based State/Province Statistics|Column-Based State/Province Statistics]]
|-
|[[Profiler Object:Column-Based Zip/Postal Code Statistics|Column-Based Zip/Postal Code Statistics]]
|-
|[[Profiler Object:Column-Based Country Statistics|Column-Based Country Statistics]]
|-
|[[Profiler Object:Column-Based Email Statistics|Column-Based Email Statistics]]
|-
|[[Profiler Object:Column-Based Phone Statistics|Column-Based Phone Statistics]]
|-
|}
|-
|
{| class="mw-collapsible mw-collapsed" style="width:100%;"
|- align="left"
! style="color:black;"|[[Profiler Object:Iterators|Iterators]]
|-
|[[Profiler Object:Column-Based Value Frequency Table Iteration|Column-Based Value Frequency Table Iteration]]
|-
|[[Profiler Object:Column-Based Value Length Frequency Table Iteration|Column-Based Value Length Frequency Table Iteration]]
|-
|[[Profiler Object:Column-Based Value Pattern Table Iteration|Column-Based Value Pattern Table Iteration]]
|-
|[[Profiler Object:Column-Based Value Date/Time Table Iteration|Column-Based Value Date/Time Table Iteration]]
|-
|[[Profiler Object:Column-Based Value SoundEx Table Iteration|Column-Based Value SoundEx Table Iteration]]
|-
|[[Profiler Object:Column-Based Word Table Iteration|Column-Based Word Table Iteration]]
|-
|[[Profiler Object:Column-Based Word Length Table Iteration|Column-Based Word Length Table Iteration]]
|-
|}
|-
|
{| class="mw-collapsible mw-collapsed" style="width:100%;"
|- align="left"
! style="color:black;"|[[Profiler Object:Result Codes|Result Codes]]
|-
|[[Returned Result Codes:APIs#Profiler Object|Returned Result Codes]]
|-
|[[Result Codes]]
|}
|}




Line 104: Line 27:
|Syntax=profiler->SetColumn(columnNameStr, valueString);
|Syntax=profiler->SetColumn(columnNameStr, valueString);
|C=mdProfilerSetColumn(profiler, ColumnName, ColumnValue);
|C=mdProfilerSetColumn(profiler, ColumnName, ColumnValue);
|.Net=profiler.SetColumnSize(ColumnName, ColumnValue);
|.Net=profiler.SetColumn(ColumnName, ColumnValue);
}}
}}


Line 110: Line 33:
This function sets the Null value of the specific column.
This function sets the Null value of the specific column.


This function takes one parameters.
This function takes one parameter.


===Parameters===
===Parameters===
Line 129: Line 52:


{{ Object Syntax
{{ Object Syntax
|Syntax=profiler->AddRecrod();
|Syntax=profiler->AddRecord();
|C=mdProfilerAddRecord(profiler);
|C=mdProfilerAddRecord(profiler);
|.Net=profiler.AddRecord();
|.Net=profiler.AddRecord();
}}
==AddDelimitedRecord==
Parses and adds the specified record. Essentially, this splits the record, and then calls SetColumn for each found field. Finally, '''[[#AddRecord|AddRecord]]''' is called to add the entire row. Note that columns are parsed in the order that they were specified by the user’s '''[[Profiler Object:Column Specification#AddColumn|AddColumn]]''' calls.
This function returns a string containing a result code:
{|class="alternate01" cellspacing="0"
!Result Code
!Description
|-
|QS90
|One of the parsed fields contains an embedded row delimiter.
|-
|QS91
|The input record did not contain all the fields specified by AddColumn(). For example, the user may have called AddColumn () 5 times to specify that there were 5 fields, but, when parsed, the input record contained only 4 fields.
|-
|QS92
|Extra fields (more than the ones specified by AddColumn ()) were parsed (the contents are discarded).
|-
|QE90
|Unbalanced text qualifiers. One of the parsed fields contained a leading text qualifier but not a trailing one (or vice-versa) (only reported when the comma is the column delimiter).
|-
|QE91
|Un-escaped text qualifier. One of the parsed fields contained a text qualifier that was not escaped (only reported when the comma is the column delimiter).
|}
The reason why QE90 and QE91 are only reported for comma-delimited record parsing is because the comma is the only standard delimiter which requires text qualifiers (because the comma appears frequently in the data it is delimiting). Other delimiters (such as tab) generally don’t require text qualification because the delimiter does not appear in the data.
However, there is an exception in that sometimes the row delimiter (ie CR+LF or CR or LF) will appear in the data, and the text qualifiers will be used to ‘protect’ the row delimiter from being parsed as a row delimiter rather than data. It is very easy for a user to create such a file in Excel (simply by creating a multi-line entry and exporting it as tab-delimited). Unfortunately, a great many ASCII importers have difficulty dealing with this convention, and will badly butcher data having embedded row delimiters.
Counts of the above result codes are provided with:
int '''[[Profiler Object:Table-Based Statistics#GetTableEmbeddedrowDelimiterCount|GetTableEmbeddedrowDelimiterCount()]]''' – QS90 count.
int '''[[Profiler Object:Table-Based Statistics#GetTableNotAllFieldsPresentCount|GetTableNotAllFieldsPresentCount()]]''' – QS91 count.
int '''[[Profiler Object:Table-Based Statistics#GetTableExtraFieldsPresentCount|GetTableExtraFieldsPresentCount()]]''' – QS92 count.
int '''[[Profiler Object:Table-Based Statistics#GetTableUnbalancedTextQualifiersCount|GetTableUnbalancedTextQualifiersCount()]]''' – QE90 count.
int '''[[Profiler Object:Table-Based Statistics#GetTableUnescapedEmbeddedTextQualifiersCount|GetTableUnescapedEmbeddedTextQualifiersCount()]]''' – QE91 count.
This function takes one parameter.
===Parameters===
{{Object Parameters
|Name=Record
|Data Type=String
|Description=A string value representing the delimited record.
}}
{{ Object Syntax
|Syntax=char* = profiler->AddDelimitedRecord(Record);
|C=char * = mdProfilerAddDelimitedRecord(profiler, Record);
|.Net=string = profiler.AddDelimitedRecord(Record);
}}
After '''[[#AddDelimitedRecord|AddDelimitedRecord]]''' has been called, the user can get the contents of each column with:
'''[[#GetColumnValue|GetColumnValue(columnName)]]''' – which returns the contents of columnName.
==GetColumnValue==
This function returns the contents of the specified column name. This comes handy to retrieve the parsed fields when using '''[[#AddDelimitedRecord|AddDelimitedRecord]]'''.
Note that this function also works for the conventional SetColumn()/AddRecord () calling convention. However, the user should assume that the data provided by GetColumnValue() is only valid until AddRecord() is called. After that, a new row buffer is initialized, and the previous row’s data may not be valid.
This function takes one parameter.
===Parameters===
{{Object Parameters
|Name=ColumnName
|Data Type=String
|Description=A string value representing the Field Name.
}}
{{ Object Syntax
|Syntax=char * = profiler->GetColumnValue(ColumnName);
|C=char * = mdProfilerGetColumnValue(profiler, ColumnName);
|.Net=string  = profiler.GetColumnValue(ColumnName);
}}
==SetColumnDelimiter==
This function sets the character that will delimit fields for the Profiler AddDelimitedRecord() function. This function needs to be set prior to calling '''[[#AddDelimitedRecord|AddDelimitedRecord]]'''.
The default value for this function is comma “,”
Note: Only the first character is recognized. Any extra characters are ignored.
This function takes one parameter.
===Parameters===
{{Object Parameters
|Name=ColumnDelimiter
|Data Type=String
|Description=A string value representing the column delimiter.
}}
{{ Object Syntax
|Syntax=profiler->SetColumnDelimiter(ColumnDelimiter);
|C=mdProfilerSetColumnDelimiter(profiler, ColumnDelimiter);
|.Net=profiler.SetColumnDelimiter(ColumnDelimiter);
}}
==SetRowDelimiter==
This function sets the character that will delimit rows (records) for the Profiler '''[[#AddDelimitedRecord|AddDelimitedRecord]]''' function. This function needs to be set prior to calling '''[[#AddDelimitedRecord|AddDelimitedRecord]]'''.
As the user is providing one row at a time, this function may seem unnecessary, but it is used to detect embedded row delimiters. If “” (an empty string) is used (which is the default), then carriage return (CR) and/or line feed (LF) are used as the row delimiters.
The default value for this function is comma “,”.
Note: Only the first character is recognized. Any extra characters are ignored.
This function takes one parameter.
===Parameters===
{{Object Parameters
|Name=RowDelimiter
|Data Type=String
|Description=A string value representing the row delimiter.
}}
{{ Object Syntax
|Syntax=profiler->SetRowDelimiter(RowDelimiter);
|C=mdProfilerSetRowDelimiter(profiler, RowDelimiter);
|.Net=profiler.SetRowDelimiter(RowDelimiter);
}}
==SetTextQualifier==
The Text Qualifier indicates the character that can (optionally) enclose fields. It is usually used to ‘protect’ in-field delimiters, and is often the double-quote character. Also, if this character appears in the field data itself, it must be properly escaped. Escaping of this character can be accomplished by doubling it, as in ‘George “”Babe”” Ruth’, or prefixing it with a backslash, as in ‘George \”Babe\” Ruth’.
The default text qualifier is the double-quote character. An empty string (“”) can be used to specify that there is no text qualifier.
Note: Only the first character is recognized. Any extra characters are ignored.
===Parameters===
{{Object Parameters
|Name=Qualifier
|Data Type=String
|Description=A string value representing the text qualifier.
}}
{{ Object Syntax
|Syntax=profiler->SetTextQualifier(Qualifier);
|C=mdProfilerSetTextQualifier (profiler, Qualifier);
|.Net=profiler.SetTextQualifier(Qualifier);
}}
}}



Latest revision as of 18:41, 6 March 2019

← Profiler Object Reference

Profiler Object Interface Navigation
Initialization
Object Information
Enumeration Listing and Parsing
Column Specification
Initiate Profiling
Data Input
Profiling
Table-Based Statistics
Column-Based Statistics
Column-Based String Statistics
Column-Based Numeric Statistics
Column-Based Date/Time Statistics
Column-Based Name Statistics
Column-Based State/Province Statistics
Column-Based Zip/Postal Code Statistics
Column-Based Country Statistics
Column-Based Email Statistics
Column-Based Phone Statistics
Frequency Iterators
Column-Based Value Frequency Table Iteration
Column-Based Value Length Frequency Table Iteration
Column-Based Value Pattern Table Iteration
Column-Based Value Date/Time Table Iteration
Column-Based Value SoundEx Table Iteration
Column-Based Word Table Iteration
Column-Based Word Length Table Iteration
Result Codes
Profiler Object Result Codes
Result Codes


For each record to be profiled, call SetColumn or SetColumnNull for each column. After the values for all columns have been specified, call AddRecord to submit the record for profiling. Note that if SetColumn or SetColumnNull are called more than once for the same column before AddRecord is called, then the last function call's data will be used. Also, if neither SetColumn nor SetColumnNull are called before AddRecord, then the column is assumed to contain a NULL (i.e., the same as if you called SetColumnNull for that column.)

SetColumn

This function sets the value of the specific column.

This function takes two parameters.

Parameters

Name Data Type Description
ColumnName String Column Name to set the value.
ColumnValue String Value for a specified column.


Syntax profiler->SetColumn(columnNameStr, valueString);
C mdProfilerSetColumn(profiler, ColumnName, ColumnValue);
.Net profiler.SetColumn(ColumnName, ColumnValue);


SetColumnNull

This function sets the Null value of the specific column.

This function takes one parameter.

Parameters

Name Data Type Description
ColumnName String Column Name to set the value to NULL.


Syntax profiler->SetColumnNull(ColumnName);
C mdProfilerSetColumnNull(profiler, ColumnName);
.Net profiler.SetColumnNull(ColumnName);


AddRecord

This function submits the record’s column values for profiling. No Parameters are required. After calling AddRecord, the result for the current record will be available using GetResults.

Syntax profiler->AddRecord();
C mdProfilerAddRecord(profiler);
.Net profiler.AddRecord();


AddDelimitedRecord

Parses and adds the specified record. Essentially, this splits the record, and then calls SetColumn for each found field. Finally, AddRecord is called to add the entire row. Note that columns are parsed in the order that they were specified by the user’s AddColumn calls.

This function returns a string containing a result code:

Result Code Description
QS90 One of the parsed fields contains an embedded row delimiter.
QS91 The input record did not contain all the fields specified by AddColumn(). For example, the user may have called AddColumn () 5 times to specify that there were 5 fields, but, when parsed, the input record contained only 4 fields.
QS92 Extra fields (more than the ones specified by AddColumn ()) were parsed (the contents are discarded).
QE90 Unbalanced text qualifiers. One of the parsed fields contained a leading text qualifier but not a trailing one (or vice-versa) (only reported when the comma is the column delimiter).
QE91 Un-escaped text qualifier. One of the parsed fields contained a text qualifier that was not escaped (only reported when the comma is the column delimiter).

The reason why QE90 and QE91 are only reported for comma-delimited record parsing is because the comma is the only standard delimiter which requires text qualifiers (because the comma appears frequently in the data it is delimiting). Other delimiters (such as tab) generally don’t require text qualification because the delimiter does not appear in the data.

However, there is an exception in that sometimes the row delimiter (ie CR+LF or CR or LF) will appear in the data, and the text qualifiers will be used to ‘protect’ the row delimiter from being parsed as a row delimiter rather than data. It is very easy for a user to create such a file in Excel (simply by creating a multi-line entry and exporting it as tab-delimited). Unfortunately, a great many ASCII importers have difficulty dealing with this convention, and will badly butcher data having embedded row delimiters.

Counts of the above result codes are provided with: int GetTableEmbeddedrowDelimiterCount() – QS90 count. int GetTableNotAllFieldsPresentCount() – QS91 count. int GetTableExtraFieldsPresentCount() – QS92 count. int GetTableUnbalancedTextQualifiersCount() – QE90 count. int GetTableUnescapedEmbeddedTextQualifiersCount() – QE91 count.

This function takes one parameter.

Parameters

Name Data Type Description
Record String A string value representing the delimited record.


Syntax char* = profiler->AddDelimitedRecord(Record);
C char * = mdProfilerAddDelimitedRecord(profiler, Record);
.Net string = profiler.AddDelimitedRecord(Record);


After AddDelimitedRecord has been called, the user can get the contents of each column with: GetColumnValue(columnName) – which returns the contents of columnName.

GetColumnValue

This function returns the contents of the specified column name. This comes handy to retrieve the parsed fields when using AddDelimitedRecord.

Note that this function also works for the conventional SetColumn()/AddRecord () calling convention. However, the user should assume that the data provided by GetColumnValue() is only valid until AddRecord() is called. After that, a new row buffer is initialized, and the previous row’s data may not be valid.

This function takes one parameter.

Parameters

Name Data Type Description
ColumnName String A string value representing the Field Name.


Syntax char * = profiler->GetColumnValue(ColumnName);
C char * = mdProfilerGetColumnValue(profiler, ColumnName);
.Net string = profiler.GetColumnValue(ColumnName);


SetColumnDelimiter

This function sets the character that will delimit fields for the Profiler AddDelimitedRecord() function. This function needs to be set prior to calling AddDelimitedRecord.

The default value for this function is comma “,”

Note: Only the first character is recognized. Any extra characters are ignored.

This function takes one parameter.

Parameters

Name Data Type Description
ColumnDelimiter String A string value representing the column delimiter.


Syntax profiler->SetColumnDelimiter(ColumnDelimiter);
C mdProfilerSetColumnDelimiter(profiler, ColumnDelimiter);
.Net profiler.SetColumnDelimiter(ColumnDelimiter);


SetRowDelimiter

This function sets the character that will delimit rows (records) for the Profiler AddDelimitedRecord function. This function needs to be set prior to calling AddDelimitedRecord.

As the user is providing one row at a time, this function may seem unnecessary, but it is used to detect embedded row delimiters. If “” (an empty string) is used (which is the default), then carriage return (CR) and/or line feed (LF) are used as the row delimiters.

The default value for this function is comma “,”.

Note: Only the first character is recognized. Any extra characters are ignored.

This function takes one parameter.

Parameters

Name Data Type Description
RowDelimiter String A string value representing the row delimiter.


Syntax profiler->SetRowDelimiter(RowDelimiter);
C mdProfilerSetRowDelimiter(profiler, RowDelimiter);
.Net profiler.SetRowDelimiter(RowDelimiter);


SetTextQualifier

The Text Qualifier indicates the character that can (optionally) enclose fields. It is usually used to ‘protect’ in-field delimiters, and is often the double-quote character. Also, if this character appears in the field data itself, it must be properly escaped. Escaping of this character can be accomplished by doubling it, as in ‘George “”Babe”” Ruth’, or prefixing it with a backslash, as in ‘George \”Babe\” Ruth’.

The default text qualifier is the double-quote character. An empty string (“”) can be used to specify that there is no text qualifier.

Note: Only the first character is recognized. Any extra characters are ignored.

Parameters

Name Data Type Description
Qualifier String A string value representing the text qualifier.


Syntax profiler->SetTextQualifier(Qualifier);
C mdProfilerSetTextQualifier (profiler, Qualifier);
.Net profiler.SetTextQualifier(Qualifier);


GetResults

This function retrieves result codes for each column in the submitted record. This should be called after AddRecord.

This function accepts one Parameter.

Parameters

Name Data Type Description
ColumnName String Column Name to get the result codes.


Return Value

This returns a result codes specific to a column in string format.

Syntax profiler->GetResults(ColumnName);
C resultStr = mdProfilerGetResults(profiler, columnstr);
.Net resultStr = profiler.GetResults(columnstr);