Question

Sharing: "Extracting a schema subset for dynamic schemas"

  • 27 September 2013
  • 0 replies
  • 1 view

Userlevel 2
Badge +17
FMEpedia article - "Extracting a schema subset for dynamic schemas" was very helpful when I challenged this question: Dynamic schema partial merge from 2 data sources   However, the article doesn't seem to be enough in the current FME, I hope the article will be updated. In the meantime, I'll share two things I got from my experiences with you.   1. Python script The script in the article doesn't work in FME 2013 SP3, because it uses old "pyfme" module. I tested the method described in the article with this script:

 

-----

 

# Example for "Extracting a schema subset for dynamic schemas" import fmeobjects   def keep_defs(feature):     att_name_list = feature.getAttribute('attribute{}.name')     att_ntype_list = feature.getAttribute('attribute{}.native_data_type')     att_ftype_list = feature.getAttribute('attribute{}.fme_data_type')     to_keep_values = feature.getAttribute('_to_keep')     keep_list = to_keep_values.split(',')          if att_name_list != None:         feature.removeAttribute('attribute{}.name')         feature.removeAttribute('attribute{}.native_data_type')         feature.removeAttribute('attribute{}.fme_data_type')         count = 0                  for i in range(len(att_name_list)):             if (att_name_list[i] in keep_list):                 feature.setAttribute('attribute{%d}.name' % count, att_name_list[i])                 feature.setAttribute('attribute{%d}.native_data_type' % count, att_ntype_list[i])                 feature.setAttribute('attribute{%d}.fme_data_type' % count, att_ftype_list[i])                 count = count + 1         # "fme_geometry{0}" is not an element of "attribute{}.name" in current FME? -----   2. "Source Provides Schema Features" parameter (Yes / No) After saving the workspace as a custom format, members of "Workspace Parameters" in Navigator will be changed. "Source Provides Schema Features" parameter appears after saving, and we have to specify "Yes" to this ("No" by default). Although the article doesn't mention about this parameter, I think it's very important. I couldn't find related articles other than: FME Evangelist: FME2010 Special: Dynamic Explained

 

Advanced Dynamic Example 2   * "Workspace Parameters" will be renamed to "Format Parameters" when you open the custom format workspace (*.fds) to edit.

 

Have a nice weekend!

 

Takashi

0 replies

Be the first to reply!

Reply