Skip to main content

Hi,

 

I have a problem extracting data from my text file.

The file looks like this:

******************************************

#Textlimiter=;

#Decimalsign=.

#Provadm

Column1, Column2...ColumnX;

"Value1";"Value2"...""ValueX";

"Value3";""Value4"..."ValueY";

#Provdat

ColumnA, ColumnB...ColumnZ;

"ValueXX","ValueYY"..."Value11";

"ValueQQ","ValueRR"..."Value22";

#End

******************************

The ProvAdm-section can contain one or more rows

The ProvDat section can also conrtain one or more rows

 

I want to read ProvAdm section into one table (SQL Server) and ProvDat into one table (SQL Server) but I dont reaaly understand how to find out where ProvAdm section ends (how many rows should be read) or where ProvData starts (where should I start reading)

 

An additional dimension to the problem is that I need to read multiple files at one go...

 

Perhaps my explanation is not complete but please ask and I will try to explain a little more 🙂

 

//Magnus

Wow that was way more complicated then I expected but I created an example workbench for you. It splits Provadm and Provdat into two seperate features and then continues on with processing the Provdat part, in the end creating the following result:

2022-03-24_17h38_33Probably not the most elegant solution but it works. You will have to create the Pravadm part yourself but you can reuse some of the transformers used for the Provdat datastream.


@mger1974​ I think I would be tempted to pre-process the text file to create a CSV file for each feature class, then process those csv files. You can take advantage of the Enable Adjacent Feature Attributes in AttributeCreator (under Advanced Attribute Handling) to create a relatively straight forward workspace to do this.

imageI've attached an example workspace (FME 2021.2) based on the sample data created by @birgit​ . This will generate a CSV files for #Provadm & #Provdat that you can then read back in a separate workspace or use the FeatureReader


Yet another approach, using  Enable Adjacent Feature Attributes, line numbering from a Counter, TestFilters, AttributeExposers, and some custom List transformers from FME Hub.

Multiline_Text


Yet another approach, using  Enable Adjacent Feature Attributes, line numbering from a Counter, TestFilters, AttributeExposers, and some custom List transformers from FME Hub.

Multiline_Text

Thank you @geomancer​, this did the trick. It also works if I run multiple files at the same time.

 

Thanks a lot!! 😀

 

Regards

Magnus


Yet another approach, using  Enable Adjacent Feature Attributes, line numbering from a Counter, TestFilters, AttributeExposers, and some custom List transformers from FME Hub.

Multiline_Text

Hi @mger1974​ , thanks for the feedback, good to know it works.

Glad I could help you!


Reply