Hi,
The strategy is:
- Read schema features from the source dataset.
- Modify data type name in the schema feature.
- Merge the schema feature (list attribute) to the data features.
- Configure the Dynamic Properties with "Destination Schema is Derived from List Attributes" method. (
https://knowledge.safe.com/articles/Samples_and_Demos/Dynamic-Workflow-Tutorial-Destination-Schema-is-Derived-from-List-Attributes)
(1) Add a Schema (Any Format) reader to the workspace, link its Dataset to the existing SDE reader's Dataset.
(2) The schema features have "attribute{}.fme_data_type" which contains FME generic data type names as its element. Here, replace every "fme_datetime" in the list with "fme_date". One possible way is to use a PythonCaller with this script, for example.
-----
def processFeature(feature):
i = 0
while True:
attrName = 'attribute{%d}.fme_data_type' % i
t = feature.getAttribute(attrName)
if t == None:
break
if t == 'fme_datetime':
feature.setAttribute(attrName, 'fme_date')
i += 1
-----
If you are not familiar with Python, you can also use a NullAttributeMapper instead.
Map: All Attributes
If Attribute Value Is:
<No Items Selected>
Or If Attribute Value Is: fme_datetime
Map To: New Value
New Value: fme_date
(3) Add a FeatureMerger; send the data features (from the existing SDE reader) to the Requestor port; send the modified schema features to the Supplier port.
Join On
Requestor: fme_feature_type
(expose in the reader)
Supplier: fme_feature_type_name
(note that it's not "fme_feature_type")
(4) Send the Merged features to the dynamic writer feature type, and configure the Dynamic Properties.
In FME 2015.1+:
Select "Schema from first feature" as the "Schema Sources".
In FME 2015.0 and earlier:
Add a NULL reader to the workspace as a Workspace Resource (Menu: Readers > Add Reader as Resource), and then select it as the "Schema Sources".
Hope this helps.
Takashi
P.S. You may have to specify the "Input Format" parameter of the Schema reader explicitly.
This is perfect Takashi !
It works fine, I just used a FeatureReader (with Schema (Any Format)) instead of the reader directly.
Thank you Takashi!!!