Skip to main content
Hi Everyone,

 

 

I've a little question to ask, How do I read a list of files from a text file (Throught text file reader), which is placed in the parent folder of another data reader in the same workspace.

 

 

I can do it manually, but I want the text file reader to automatically read a certain file from the parent folder. The attributer creater is not willing to expose my created attributes as private/public variable, which i wanted to use as an input to Text file reader.

 

 

Thanks
Hi,

 

 

as you discovered, you cannot set the value of of a private/pubilc attribute from within the workspace, they're effectively read-only as long as the workspace is running.

 

 

Perhaps you should look into Python scripted parameters, where you can write a Python script that calculates this values when the workspace starts, e.g. on the basis of other (static) parameters.

 

 

David
Or use a filewriter to write your dynamicaly created attributes after u used attributeexposer on them, then workspacerunner to call filereader.
Hi, 

 

 

I can set the Source Text File (Text file reader) to a Published attribute, the problem lies in getting the parent Folder. I also can do it by using FileNamePart Extracter. Just not able to expose the extracted Features as Public / Private parameters.

 

 

Thanks.
If u are talking setting parameters during runtime..that can only be done using phyton or tcl etc. (there is a forumtopic somwhere thiss late june/july somewhere)

 

If u are talking attributes, this can be done using attributeexposer==>featurewriter==>featurereader combo. I have posted a neat script to accomplish this. Or there are some posts using phyton to do same.
Hi,

 

 

here's a short Python scripted parameter that will return the parent directory of another published/private parameter:

 

 

---

 

import os.path

 

filename = FME_MacroValuesV'MY_FILENAME']

 

return os.path.abspath(os.path.join(filename, os.pardir))

 

---

 

 

Assumes that there is a published/private parmeter called MY_FILENAME. The scripted parameter must appear BELOW this parameter in the Navigator pane (i.e. order of execution).

 

 

David
Hi,

 

 

Thanks David, by using python script provided by you, I created what I wanted. Thanks a lot.

Reply