Skip to main content
Question

How to edit the CAT reader input file definition in FME 2019


I'm trying to re-edit a CAT input file definition I was able to nicely define while I was adding the CAT reader to a workspace using the ruler paradigm. Now that I have added the CAT reader to the workspace, I can't seem to find a way back to add/extend/change the definitions using that editor. Any way back to that editor? I'm using FME 2019.

 

 

4 replies

mark2atsafe
Safer
Forum|alt.badge.img+44

You would use Readers > Update Feature Types. You have to go through there because changing the definitions would change the schema and so the feature type needs an update.


  • Author
  • May 28, 2019

Thanks Mark, that helps.

On this same topic, I am trying to wrap my head around how to loop through the text file feature by feature using the CAT reader. Basically each line in the column aligned input file has a series of sub record numbers at the beginning of each line, i.e. 01, 02, 03, etc. Taken together, these sub records constitute one feature and then begin with 01 again for the subsequent feature. Some of these subrecords are optional. Also, the unique feature ID attribute occurs only inside subrecord type 02.

Is there anyway to process the records as a whole using the CAT reader? I am thinking I may need to use Python for this.

 


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • May 28, 2019
rwhite wrote:

Thanks Mark, that helps.

On this same topic, I am trying to wrap my head around how to loop through the text file feature by feature using the CAT reader. Basically each line in the column aligned input file has a series of sub record numbers at the beginning of each line, i.e. 01, 02, 03, etc. Taken together, these sub records constitute one feature and then begin with 01 again for the subsequent feature. Some of these subrecords are optional. Also, the unique feature ID attribute occurs only inside subrecord type 02.

Is there anyway to process the records as a whole using the CAT reader? I am thinking I may need to use Python for this.

 

In similar situations I have used tester/testFilter and VariableSetters/Retrievers.

 

 

tester to identify start of new feature (subrecord = 1), if passed, counter to get a uniqueId, variableSetter (_count). If failed, variableRetriever.

 

 

Both pipelines connect to an aggregator or similar transformer, grouped-by the _count.

 

 

Alternatively you can use the enable adjacent feature settings on the attributeCreator/Manager, with conditionals.

mark2atsafe
Safer
Forum|alt.badge.img+44
rwhite wrote:

Thanks Mark, that helps.

On this same topic, I am trying to wrap my head around how to loop through the text file feature by feature using the CAT reader. Basically each line in the column aligned input file has a series of sub record numbers at the beginning of each line, i.e. 01, 02, 03, etc. Taken together, these sub records constitute one feature and then begin with 01 again for the subsequent feature. Some of these subrecords are optional. Also, the unique feature ID attribute occurs only inside subrecord type 02.

Is there anyway to process the records as a whole using the CAT reader? I am thinking I may need to use Python for this.

 

I would go with the adjacent feature handling. Personally, I'm not a fan of VariableSetters/Retrievers. I wrote a blog post about how to handle this type of structured data using adjacent feature handling: https://www.safe.com/blog/2017/08/adjacentfeatureattributes-evangelist166/ - although it's not exactly the same structure that you have, it would be a good intro to what you need to do.

I think I would fetch the previous record (so set that value to 1 in the Adjacent Feature parameters). I would Test for line = 02, then use that to construct a new "record" with that info and the info for line = 01 (which it will have fetched). Other lines just take the "record" from the previous feature and add to it.

Basically 01 can be ignored (it gets used by the 02 record). 02 constructs a new record. 03, 04, etc just fetch the previous record and add to it.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings