Skip to main content
Solved

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


Forum|alt.badge.img

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?

Best answer by takashi

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""
View original
Did this help you find an answer to your question?

8 replies

david_r
Evangelist
  • April 1, 2016

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


Forum|alt.badge.img
  • Author
  • April 1, 2016

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

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

but it is rejected as well.


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • Best Answer
  • April 1, 2016

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""

Forum|alt.badge.img
  • Author
  • April 1, 2016

takashi, that's the solution, thank you!


david_r
Evangelist
  • April 1, 2016
kath wrote:

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.


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • April 1, 2016
kath wrote:

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 ;)


Forum|alt.badge.img
  • August 27, 2018

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


fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • August 27, 2018
40_eme wrote:

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.

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings