Solved

Use an attribute containing a list of files as FeatureReader Input Dataset

  • 1 April 2016
  • 8 replies
  • 32 views

Badge

Hi,

I'm setting up an attribute containing a list of files, and then I want to use it as input Dataset in a FeatureReader.

e.g. the attribute contains the string: "C:\\a.jpg","C:\\b.jpg"

The featureReade will reject the attribute as input Dataset

If I hardcode the same string in the FeatureReader Dataset field it works fine.

I also tried to use a workspace runner to convert the attribute to a Published Parameter as input for a reader, but the same problem appears.

Can anyone help me out?

icon

Best answer by takashi 1 April 2016, 13:11

View original

8 replies

Userlevel 4

Hi

You will have to remove the quotes around the filename in your attribute before passing it on to the FeatureReader. You can use a StringReplacer for this, set "Text to match" as a double quote (") and leave Replacement text empty.

David

Badge

This doesn't work either. My Attribute is now like

C:\\a.jpg,C:\\b.jpg

but it is rejected as well.

Userlevel 2
Badge +17

Hi @kath, try this - separate the quoted paths by a whitespace, and surround the entire string with double quotations.

""C:\a.jpg" "C:\b.jpg""
Badge

takashi, that's the solution, thank you!

Userlevel 4

This doesn't work either. My Attribute is now like

C:\\a.jpg,C:\\b.jpg

but it is rejected as well.

Aha, I didn't realize that you had several filenames in the same attribute value.

Userlevel 2
Badge +17

takashi, that's the solution, thank you!

Good to hear it works.

In fact, that's a "rule of thumb". I can't explain the reason why it works but comma-separated format doesn't work. Hope someone from Safe to clarify this ;)

Badge

Hi,

 

I feel that this post should correspond to what I am trying to do but I do not understand the solution. I want to use a table containing a path attribute and a file name attribute as the source data list.

 

Thank you.

Should I create a unique string of the form "" C: \\ a.jpg "" C: \\ b.jpg "" ...... ?

Thanks

Userlevel 4
Badge +13

Hi,

 

I feel that this post should correspond to what I am trying to do but I do not understand the solution. I want to use a table containing a path attribute and a file name attribute as the source data list.

 

Thank you.

Should I create a unique string of the form "" C: \\ a.jpg "" C: \\ b.jpg "" ...... ?

Thanks

If you don't already have a list (you don't) then I'd suggest just reading the input table and making a new attribute out of the concatenation of the path and the filename and then using that as the dataset for the FeatureReader. So in the FeatureReader you'd say that the dataset was coming from an attribute (in fact, you could use the "string editor" to join the parts together right in the FeatureReader's source dataset properties.

 

 

No need to join the rows into one long list -- just feed the individual rows into the FeatureReader and it will do as you desire.

 

 

Reply