Hey Mark,
when I read Steve's post I was about to write about the FMEFunctionCaller
when I saw that you already did so with particular greetings to me :)
That's cool ...
You can even go further:
For the moment the problem is that you do not know how many times you should
call @CopyAttributes(@Value(histogramList{0}.value),histogramList{0}.count)
as you do not know how many values you have.
I would do this:
create a custom transformer
in this one, I would integrate a ListElementcounter (=> _nCount) and thanks
to the superb looping functionnality in the custom transformer, I would add
a loop port looping exactly nCount (with a tester (_i < _nCount) and and
Expressionevaluator=> _i = _i + 1) times to call @CopyAttributes(@Value(
[EMAIL PROTECTED](_i)}.value),[EMAIL PROTECTED](_i)}.count)
(okok, I saw further down in your email, that you were already suggesting
this, but now it's written down :))
And for the "Exposer": Seems a bit more difficult to make it dynamic as the
schema will be data driven.
The important is that the attributes are there, even if you cannot see them
in Workbench.
Greetings,
Jeff
On 5/31/07, mark2atsafe <[EMAIL PROTECTED]> wrote:
Hi Steve,
Assuming I read it right, there's a couple of options.
1) Do it manually. Expose _DEP_histogram{0}.count and then in an
AttributeCreator create an attribute called OnTime using the exposed
attribute to set the value.
2) Automatically. Use Jeff Konnen's excellent idea for the
FMEFunctionCaller - I just tried this with a workspace using the syntax...
@CopyAttributes(@Value(histogramList{0}.value),histogramList{0}.count)
...and it worked fine.
The only problem is that the attribute isn't 'exposed' within
Workbench. You'd have to expose it manually.
I will post my workspace to fmepedia shortly as an example of how to
use FMEFunctionCaller (and ListHistogrammer). In fact I might even
roll it into a custom transformer, because then you could loop through
the list creating an attribute for each entry.
With development for FME2008 due to start I'm sure we (the support
team) will be asked what our hot issues are for this year. I think I
will suggest a transformer to create an attribute, taking the
attribute name from an existing attribute value. It seems to be a
popular need.
If you have FME suggestions then don't forget the add them the list on
fmepedia... http://www.fmepedia.com/index.php/FME_Suggestions (we do
look at this, promise).
Regards,
Mark
Mark Ireland, Senior Product Specialist
Safe Software Inc. Surrey, BC, CANADA
[EMAIL PROTECTED] <support%40safe.com> http://www.safe.com
Solutions for Spatial Data Translation, Distribution and Access
--- In [email protected] <fme%40yahoogroups.com>, "snelsons2006" <
[EMAIL PROTECTED]> wrote:
>
> Hi group,
> Can anyone think of a way to use the results from the
> ListHistogrammer as new attributes? I've tried exposing attributes
> but can't find a way to create new attribute/headings with the
> Histogrammer results...
>
> I'm reading a spreadsheet, and creating a list based on a column,
> then I'm using the ListHistogrammer to see how many 'counts' of each
> value I have.
>
> A sample of my results:
> _DEP_histogram{0}.count: 78
> _DEP_histogram{0}.value : OnTime
> _DEP_histogram{1}.count: 9
> _DEP_histogram{1}.value : LeaveEarly
> _DEP_histogram{2}.count: 7
> _DEP_histogram{2}.value : LeaveVeryLate
> _DEP_histogram{3}.count: 3
> _DEP_histogram{3}.value : LeaveLate
> _DEP_histogram{4}.count: 1
> _DEP_histogram{4}.value : LeaveVeryEarly
>
> Is there a way to be able to then have 5 new attributes with the
> corresponding list "value", and the "count" as the new attribute's
> value - like this:
>
> OnTime 78
> LeaveEarly 9
> LeaveVeryLate 7
> Leave Late 3
> LeaveVeryEarly 1
>
--
Jeff Konnen
INSER SA
Switzerland
+41 (0) 21 643 77 11