Skip to main content

Have used a feature merger to merge several excel lists together and want to output them to a single excel worksheet. I've got it working fine except when I run a sorter before the writer, and sort numerically off of one of my numeric fields, the writer will add and additional page to the excel file and put information from one list on the actual intended sheet and information from the other on the additional sheet (if I use an inspector and view the list in Data Inspector it's perfect). If I sort on the exact same field, but do it alphabetically, it puts everything on the single sheet I specify (but of course is not sorted the way I'd like). Any ideas?

The field seems to be a character field in the source.

If you add an ExpressionEvaluator before the Sorter (expression Field * 1) it will force the Field to be numeric. That should allow the numeric sort without the issue.


Could you please post a screenshot of the Excel writer feature type properties dialog Parameters tab?

 

 


I think seeing the workflow would be helpful too. If you can post the workspace and input data then we'd know for sure what is going on. Interesting case.

Checked both input fields, both are numeric. Did add ExpressionEvaluator as suggested, to no avail.


Here is the feature Type parameters for the Excel Writer

writerparameters.gif


I think seeing the workflow would be helpful too. If you can post the workspace and input data then we'd know for sure what is going on. Interesting case.
Here's the workflow Part A and B. I've duplicated the sorter in the screenshots for reference as to where they go together (there's only 1 sorter). I'm rather new to FME, but I'll try to explain what I have going on.

 

Starting on the left, I am merging video channel and data channels for multiple cable systems, forming an "all active channels form all cable systems" list.

 

At FeatureMerger_3, I'm adding in a Lower Edge attribute which is what I will sort by. The reader for "DSON...nels" shows Lower Edge as a number.

 

At FeatureMerger, I'm adding in vacant channels (so lets say I have 100 channels that I can have content on, but only have 75 active channels, I want to show the other 25 vacant slots). So DS750 is a list of all possible channels and also has a Lower Edge field (also numeric in the reader). So I'm keeping all of the active channels (Merged) and adding in the vacants (Unused Supplier).

 

Then I try to sort by Lower Edge. If I sort numerically, my output is split onto 2 pages with all of my original active channels on one page, and all of my vacant channels on another, both sorted correctly, numerically. If I sort alphabetically, everything shows up on one page, as I'd like it to, but of course it's sorted alphabetically, which I don't want.

 

In the attached Excel screenshots, the active channels are colored orange and the vacants are red a green. As you can see, FME is adding an extra page when sorted numerically.

 

As suggested by another answer, I did try adding an ExpressionEvaluator previous to the sorter and multiplying Lower Edge by 1. Did not work.workflow-part-a.gif workflow-part-b.gif numeric-a.gif numeric-b.gif alphabetic.gif

Here is the feature Type parameters for the Excel Writer

writerparameters.gif

Check if all the features always have an identical value in the attribute "ChannelMap". I suspect some features lost the value of "ChannelMap" in a certain condition.

 

If you want to write every feature always into the same worksheet named "Covington", you can just set the literal "Covington" to the Sheet Name parameter, rather than setting the attribute "ChannelMap".

 


Here is the feature Type parameters for the Excel Writer

writerparameters.gif

I can see that 41 features are output from the UnusedSupplier port of the FeatureMerger in your screenshot. Do the unused features have the "Channel Map" attribute?

 

Have you changed the "Comparison Mode" too in the FeatureMerger according to the sorting mode setting (Alpha/Num) in the Sorter?

 


@takashi

Changing the page name to "Covington" rather than using the ChannelMap attribute did the trick. Totally makes sense now. My Vacant list (DS750) does not contain the "ChannelMap" field, as I'll need to use it for the other systems as well. Although, I guess I'm curious as to why sorting the Lower Edge attribute alphabetically would put everything on one page - I would expect that it would still use 2 pages. At any rate it seems to work perfectly now. Appreciate the input.


@takashi

Changing the page name to "Covington" rather than using the ChannelMap attribute did the trick. Totally makes sense now. My Vacant list (DS750) does not contain the "ChannelMap" field, as I'll need to use it for the other systems as well. Although, I guess I'm curious as to why sorting the Lower Edge attribute alphabetically would put everything on one page - I would expect that it would still use 2 pages. At any rate it seems to work perfectly now. Appreciate the input.

Yes, it's curious that every feature goes to a single worksheet when you sorted them with alphabetic mode.

 

When you sorted them with alphabetic mode, the 41 features still were output via the UnusedSupplier port of the FeatureMerger?

 


Reply