Question

Parameter-based reader format for FME Sever

  • 17 April 2013
  • 9 replies
  • 4 views

Badge
Hi FMErs.  

 

 

I have workbench on FME sever where I want to have either dwg or shp as the input file.  I have set up a paramer called clipper_reader_formats which is choice based (with alias).  In the configuration I have imported the two formats and then linked this parameter to the Reader Input Formats.

 

 

In FME server I now have options visible that let me select the appropriate reader.  However, I am having trouble with the actual Source dataset field:

 

 

If I have it as:

 

\\\\glofme02\\data\\Tasks\\Clip_By_Polygons\\Reader\\Clippers\\*.*

 

it doesn't work

 

 

It does work if I put in:

 

\\\\glofme02\\data\\Tasks\\Clip_By_Polygons\\Reader\\Clippers\\*.shp

 

but this only works for shp files obviously.

 

 

I'd like the workbench to pick up the relevant files, but only for the formats specified or selected.  I'm not sure what I need to put in this field.

 

 

Thanks. 

9 replies

Userlevel 4
Hi Amit,

 

 

how about using FeatureReader(s) rather than regular readers?

 

 

David
Badge
Hi David,

 

 

Thanks for the reply.  This isn't a transformer I'm familiar with but going to give it a go!  I've added a Creator followed by the FeatureReader, in the Wizard (FeatureReader Parameters) it prompts me to select a Format which I've left blank.  With the Dataset field, it won't accept *.*, it prompts me to to select a file which then populates the Format field too.

 

 

Any advice on how I can make this format independent?  Ideally, I'd like to restrict the reader formats to a shp or dwg to prevent user error.

 

 

Thanks again.
Badge
OK, I can see now that you can enter the settings under the transformer parameters.  

 

 

Not sure what to put in the FeatureTypes to Read?

 

 

 

Userlevel 4
Hi Amit,

 

 

the easist might be to create a FeaureReader for each of your input formats. The filenames could be set to wildcards, e.g. "C:/InputData/*.shp" for the shape files. That seems to work for me using FME2013sp1.

 

 

You could then use a Tester or TestFilter after the creator to route the initiating feature to the correct FeatureReader, depending on the published parameter that defines the format type to read.

 

 

David
Badge
Hi David,

 

 

Thanks for the advice, I'll give it a go and let you know!

 

 

Amit
Userlevel 4
Badge +25
Yes, I think I would use a different FeatureReader for each format.

 

 

The other alternative would be to simply use a Generic format reader. Then the user could just pick which dataset to read (Shape or DWG) and wouldn't have to set the source format.

 

 

I think in this case I'd still go with the FeatureReader, because you only have two formats.

 

 

Hope this helps

 

 

Mark

 

 

Mark Ireland

 

Product Evangelist

 

Safe Software Inc
Badge
Hi, thank you both for your replies.  I'm using the FeatureReader method at the moment, but need a bit of help joning the dots!

 

 

David, in your post you mention routing the data through the Tester, so the test is set to test the fme_dataset attribute, however I'm not sure what order to place the transformers.  If I have:

 

 

Creator > Tester > Feature Reader (x2, one for each datatype)

 

 

then I can't see how to perform the test as the Tester can't see the datasets (as they are introduced after the Tester).  Have I misunderstood your methodology or am I missing something?

 

 

Thanks again.
Userlevel 4
Hi Amit,

 

 

I would simply define a new published parameter to select between the two input data types. Then use this parameter in the tester.

 

 

As you have already discovered, fme_dataset doesn't make much sense in this scenario.

 

 

David
Badge
Right, getting closer!

 

 

I have set up a Creator feeding into an AttributeFilter which ports out ACAD and SHAPE files accordingly based on a user parameter.  Based on this, the appropriate FeatureReader is used before routing to the next transformer.  

 

 

Something isn't right though as data isn't passing through the workbench, I've linked to a screenshot here:

 

 

http://db.tt/Iwm4OKO2

 

 

Each of the Feature Reader have the relevant format wilcard, e.g. *.dwg, and I've linked out of the Initator port, as the layers that show up (for CAD files) may not be present in all the files.

 

 

I''m still a bit confused abot the methodology, how does the workbench see the datsets before they are read in by the FeatureReader?  

 

 

Thanks.

 

 

Reply