Hi Gio,
Â
Â
your post reminded me of Fermat: "I have discovered a truly marvellous proof of this, which this margin is too narrow to contain." ;-)
Â
Â
Look forward to hearing more about your solution.
Â
Â
David
Â
Â
Ref:Â
http://en.wikipedia.org/wiki/Fermat's_Last_Theorem#Fermat.27s_conjecture (
http://en.wikipedia.org/wiki/Fermat's_Last_Theorem#Fermat.27s_conjecture)
David,
Â
Â
Actually the solution is very simple (in hindsight). Fermat would'nt waste ink on this i gather...and of course Fermat had no FME license....;)
Â
Â
Like i said it is the directory and file-attributesreading question by Robbie B. that led me to this solution.
Â
Â
One creates some dynamica attributes like _att_name(), _att_value1(), att_value2() etc.
Â
Create lists of these based on groupings like for instance
Â
_att_name() grouped by feature_type.
Â
_att_value1(), att_valu2e() etc. grouped by _att_name.
Â
Â
Grouped _att_name() reduced to 1 record (b for instance matcher)
Â
Â
Use listconcatenator on both lists (choose relevant delimtter).
Â
Use a filewriter to write it to a csv.
Â
Writing need be done in order ofcourse, so record with attribute names is on top (1st row)
Â
Â
In this workbench a sql export file is read and then written and linked to some arbitraty objects.
Â
Â
Â
Â
.how u get to your dynamically created attributes (Atttributes on the fly)Â is not relevant (see also the issue by Robbie)
Â
Â
Basically the filewriting (to csv) and Workspacerunner (csv reading) does the "exposing"
Â
Once it is read trough Workspacerunner, the attributes become accesable.
Â
Â
Â
Â
Â
When you have created a csv, clear all its values (<not set>) Clear also all attirubtes (unselect)
Â
Same goes for any writer u use (in this case an excell) and set Dynamic properties (alas no parameters can be used at this point..:(Â Â )
Â
Â
Everything is parametrised, only main workbench has parameters where u can choose directory and files.
Â
Â
If original data has geometry, you could push the geometry trough the csv as well using Geometryextractor (Geometryreplacer to read it back again).
Â
You might get big csv's though (especially when u have arcs) so i prefer to merge the attributes afterwards to the geometry.
Â
Â
Sample wrokspace to use the attributes, linking them to arbitrarily created shapes.
Â
Â
(all workspaces that are intended to be called by runners cannot be run by themselvves as all schema's, source and destinations are removed to be parametrised)
Â
Â
Source to result (source is a MySql datadumpfile)
Â
Â
Â
Â
So here u have it, dynamic attributes and no manual (or imported ) exposures whatsoever.
Â
The main trick lies in the filewriter an worksacerunners and full parametrising.
I forgot to tell that you need to clear the files if u reuse it on other files. If you don't the number of attributes is limited to the first file u read.
Â
Â
I therefore have a startup tcl in the main workspace that clears this:
Â
if { file exists $FME_MacroValues(DestDataset_XLS_ADO)] == 1 } {
Â
   puts concat Deleting $FME_MacroValues(DestDataset_XLS_ADO)]
Â
   file delete -force $FME_MacroValues(DestDataset_XLS_ADO)
Â
} else {
Â
   puts
 }Â
if { /file exists $FME_MacroValues(DestDataset_CSV)] == 1 } {Â
   puts {concat Deleting $FME_MacroValues(DestDataset_CSV)]Â
   file delete -force $FME_MacroValues(DestDataset_CSV)Â
} else {Â
   puts pconcat $FME_MacroValues(DestDataset_CSV) does not exist]Â
}Â
if { ofile exists $FME_MacroValues(DestDataset_XLSXW)] == 1 } {Â
   puts Xconcat Deleting $FME_MacroValues(DestDataset_XLSXW)]Â
   file delete -force $FME_MacroValues(DestDataset_XLSXW)Â
} else {Â
   puts tconcat $FME_MacroValues(DestDataset_XLSXW) does not exist]Â
}Â
Â
(yeah..i used both the excell writers duting creation)
Thanks for the details, interesting.
Â
Â
This is something I've done a few times, but then using Python exclusively. Neat to see it done with only regular transformers.
Â
Â
David