I am trying to create a single ini file from multiple database tables. Each table has two columns LCODE,LVALUE.
Each table name should become the section heading and the items below them should contain the rows in the format LCODE=LVALUE
There should be a single empty line between the last row of a section and the next section heading
The ini file would look like this:
[ARTWORK_MATERIAL]
STEEL=PLAIN STEEL
ALUMINIUM=UNPAINTED ALUMINIM
[ARTWORK_TYPE]
SCULPTURE=The artwork is a sculpture
MOSAIC=The artwork is a mosaic
and so on.
Any help would be fantastic.
Cheers
Paul
Best answer by lenaatsafe
Hi @paulgdowling
I would try to use Sampler, Counter/AttributeCreator, Cloner, and Sorter. Let me explain.
You could add ID attribute to your features read from different tables so that all features that belong to the same table have the same ID value or features from each table are counted separately starting with 1 (if it is important to preserve the order in the ini-file).
All features read from the source tables should also get iniLINE attribute with @Value(LCODE) = @Value(LVALUE) value.
Then you could add two copies of a single feature from each table. These features should have ID = 0 and ID = 1000 (or any number bigger than the number of expected tables/ number of features read from the table). The ID = 0 feature should have [<table name>] as iniLINE attribute while ID = 1000 feature should have iniLINE <empty> or <missing>.
After this prep work is done, you could order your features by table names and IDs and write them in this order to the ini-file.
I would try to use Sampler, Counter/AttributeCreator, Cloner, and Sorter. Let me explain.
You could add ID attribute to your features read from different tables so that all features that belong to the same table have the same ID value or features from each table are counted separately starting with 1 (if it is important to preserve the order in the ini-file).
All features read from the source tables should also get iniLINE attribute with @Value(LCODE) = @Value(LVALUE) value.
Then you could add two copies of a single feature from each table. These features should have ID = 0 and ID = 1000 (or any number bigger than the number of expected tables/ number of features read from the table). The ID = 0 feature should have [<table name>] as iniLINE attribute while ID = 1000 feature should have iniLINE <empty> or <missing>.
After this prep work is done, you could order your features by table names and IDs and write them in this order to the ini-file.
I would try to use Sampler, Counter/AttributeCreator, Cloner, and Sorter. Let me explain.
You could add ID attribute to your features read from different tables so that all features that belong to the same table have the same ID value or features from each table are counted separately starting with 1 (if it is important to preserve the order in the ini-file).
All features read from the source tables should also get iniLINE attribute with @Value(LCODE) = @Value(LVALUE) value.
Then you could add two copies of a single feature from each table. These features should have ID = 0 and ID = 1000 (or any number bigger than the number of expected tables/ number of features read from the table). The ID = 0 feature should have [<table name>] as iniLINE attribute while ID = 1000 feature should have iniLINE <empty> or <missing>.
After this prep work is done, you could order your features by table names and IDs and write them in this order to the ini-file.
Hi @LenaAtSafe
Thank you for your help! I have managed to create a workbench, using your instructions but ended up using a few different transformers based on my limited skills.I was unsure how to use the sampler so used the LISTBUILDER instead. I was also not proficient with the CLONER so used a slightly different process shown below.
I could not have done it without your suggestions though so thank you so much.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.