IDtObjectDataFormat.UsePredefinedDateFormats

Syntax

UsePredefinedDateFormats: Boolean;

Description

The UsePredefinedDateFormats property determines the use of the field date format predefinition according to the specified format using the IDtFieldDefinition.DateFormat property.

Comments

Available values of the property:

Example

Executing the example requires that the repository contains an ETL task with the ETL identifier. There is also the Data_Import.txt text file located in the C:\Temp\Data_Import folder.

File contents

Add links to the Andy, Dal, Drawing, Dt, Etl, Forms and Metabase system assemblies.

<font color="#008080">Sub</font><font color="#000000">&nbsp;UserProc;<br /> </font><font color="#008080">Var</font><font color="#000000"><br /> &nbsp;&nbsp;&nbsp;&nbsp;MB:&nbsp;IMetabase;<br /> &nbsp;&nbsp;&nbsp;&nbsp;EtlTask:&nbsp;IEtlTask;<br /> &nbsp;&nbsp;&nbsp;&nbsp;EtlProvider:&nbsp;IEtlPlainDataProvider;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider:&nbsp;IDtTextProvider;<br /> &nbsp;&nbsp;&nbsp;&nbsp;DateFormat:&nbsp;IDtObjectDataFormat;<br /> &nbsp;&nbsp;&nbsp;&nbsp;WxProvider:&nbsp;IWxRectangle;<br /> &nbsp;&nbsp;&nbsp;&nbsp;WxETLProvider:&nbsp;IWxETLObject;<br /> </font><font color="#008080">Begin</font><font color="#000000"><br /> &nbsp;&nbsp;&nbsp;&nbsp;MB&nbsp;:=&nbsp;MetabaseClass.Active;<br /> &nbsp;&nbsp;&nbsp;&nbsp;EtlTask&nbsp;:=&nbsp;MB.ItemById(</font><font color="#800000">&quot;ETL&quot;</font><font color="#000000">).Edit&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IEtlTask;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//Create&nbsp;object&nbsp;&quot;Import&nbsp;from&nbsp;text&quot;<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;EtlProvider&nbsp;:=&nbsp;EtlTask.Create(EtlObjectType.PlainDataTextProvider)&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IEtlPlainDataProvider;<br /> &nbsp;&nbsp;&nbsp;&nbsp;EtlProvider&nbsp;:=&nbsp;EtlProvider.Edit;<br /> &nbsp;&nbsp;&nbsp;&nbsp;EtlProvider.Id&nbsp;:=&nbsp;</font><font color="#800000">&quot;Data_Import&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;EtlProvider.Name&nbsp;:=&nbsp;</font><font color="#800000">&quot;Data_Import&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;EtlProvider.Description&nbsp;:=&nbsp;</font><font color="#800000">&quot;Data_Import&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//Set&nbsp;up data&nbsp;provider<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;TextProvider&nbsp;:=&nbsp;EtlProvider.Provider&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IDtTextProvider;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.File&nbsp;:=&nbsp;</font><font color="#800000">&quot;C:\Temp\Data_Import.txt&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;DateFormat&nbsp;:=&nbsp;TextProvider.StringDataFormat;<br /> &nbsp;&nbsp;&nbsp;&nbsp;DateFormat.UsePredefinedDateFormats&nbsp;:=&nbsp;</font><font color="#008080">True</font><font color="#000000">;</font><font color="#008000"><br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;TextProvider.FieldsFromFile;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.Fields.item(</font><font color="#008000">0</font><font color="#000000">).DateFormat&nbsp;:=&nbsp;</font><font color="#800000">&quot;$Year$A$Quarter$&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.Fields.item(</font><font color="#008000">0</font><font color="#000000">).DataType&nbsp;:=&nbsp;dbdatatype.Date;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.Fields.item(</font><font color="#008000">1</font><font color="#000000">).DateFormat&nbsp;:=&nbsp;</font><font color="#800000">&quot;$Year$M$Quarter$&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.Fields.item(</font><font color="#008000">1</font><font color="#000000">).DataType&nbsp;:=&nbsp;dbdatatype.Date;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.Fields.item(</font><font color="#008000">2</font><font color="#000000">).DateFormat&nbsp;:=&nbsp;</font><font color="#800000">&quot;$Year$$Month$$Day$&quot;</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;TextProvider.Fields.item(</font><font color="#008000">2</font><font color="#000000">).DataType&nbsp;:=&nbsp;dbdatatype.Date;<br /> &nbsp;&nbsp;&nbsp;&nbsp;EtlProvider.FillDefault;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//Save&nbsp;provider<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;EtlProvider.Save;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//Create&nbsp;visual&nbsp;object<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;WxProvider&nbsp;:=&nbsp;EtlTask.Workspace.CreateRectangle;<br /> &nbsp;&nbsp;&nbsp;&nbsp;WxETLProvider&nbsp;:=&nbsp;</font><font color="#008080">New</font><font color="#000000">&nbsp;WxETLObject.Create;<br /> &nbsp;&nbsp;&nbsp;&nbsp;WxETLProvider.ETLObject&nbsp;:=&nbsp;EtlProvider;<br /> &nbsp;&nbsp;&nbsp;&nbsp;WxProvider.Style.TextPosition&nbsp;:=&nbsp;WxTextPosition.Bottom;<br /> &nbsp;&nbsp;&nbsp;&nbsp;WxProvider.Style.PictureMarginTop&nbsp;:=&nbsp;-</font><font color="#008000">10</font><font color="#000000">;<br /> &nbsp;&nbsp;&nbsp;&nbsp;WxProvider.PinPosition&nbsp;:=&nbsp;</font><font color="#008080">New</font><font color="#000000">&nbsp;GxPointF.Create(</font><font color="#008000">50</font><font color="#000000">,&nbsp;</font><font color="#008000">50</font><font color="#000000">);<br /> &nbsp;&nbsp;&nbsp;&nbsp;WxProvider.Extension&nbsp;:=&nbsp;WxETLProvider&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IWxShapeExtension;<br /> &nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#008000">//Save&nbsp;task&nbsp;Etl<br /> </font><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;(EtlTask&nbsp;</font><font color="#008080">As</font><font color="#000000">&nbsp;IMetabaseObject).Save;<br /> </font><font color="#008080">End</font><font color="#000000">&nbsp;</font><font color="#008080">Sub</font><font color="#000000">&nbsp;UserProc;</font>

On executing the example a new data provider will be created in ETL task - Import from text. The provider will be linked to the specified text file, various formats will be preconfigured to parse dates in various fields. As a result of import, the following values will be obtained:

See also:

IDtObjectDataFormat