Skip to main content
Solved

How to save the writer to a certain location based on the root folder of the source dataset?

  • December 22, 2022
  • 4 replies
  • 29 views

joy
Enthusiast
Forum|alt.badge.img+15
  • Enthusiast

Hello everyone,

For example, I have the following pathname of the source dataset

C:\\Temp\\FME Workbenches\\Kabelleidingen\\Klic\\Klicdata.dgn

 

Then I would like to write the end result of the script to the following

location.

C:\\Temp\\FME Workbenches\\Kabelleidingen\\Klic\\KlicData_analysis

So partly I want to write the data away to the root folder of the source dataset.

Does anyone know how I can achieve that?

The question is thus how I can get the value of the rootfolder that I subsequently can use in the writer.

Best answer by dustin

You can use a StringSearcher to extract the root folder from the fme_dataset format attribute using this regex (you'll need to expose fme_dataset on your reader):

.*\\

imageThen on your writer, you can set the fanout parameter to _first_match:

imageYou can also append an additional directory to the end of the extracted root folder if needed:

image

View original
Did this help you find an answer to your question?

4 replies

dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • Best Answer
  • December 22, 2022

You can use a StringSearcher to extract the root folder from the fme_dataset format attribute using this regex (you'll need to expose fme_dataset on your reader):

.*\\

imageThen on your writer, you can set the fanout parameter to _first_match:

imageYou can also append an additional directory to the end of the extracted root folder if needed:

image


joy
Enthusiast
Forum|alt.badge.img+15
  • Author
  • Enthusiast
  • December 22, 2022
dustin wrote:

You can use a StringSearcher to extract the root folder from the fme_dataset format attribute using this regex (you'll need to expose fme_dataset on your reader):

.*\\

imageThen on your writer, you can set the fanout parameter to _first_match:

imageYou can also append an additional directory to the end of the extracted root folder if needed:

image

@dustin​ Thank you for the steps. I am only stuck what to fill in the "Fanout Destination Directory". I fill in "@value(_first_match) for this one and for the fanout directory @value(fme_basename)_analysis.

However instead of using the _first_match to find the pathname, it creates a new map called @value(_first_name). See image below. In my case I would like to put the destinatoin file in the folder Klic Stephensonstraat_22O12280 instead. So I am wondeirng why it's not recognizing the _first_match value, while I provide that value to the writer. It also doesn't recognize the fme_basename value, since only the addition _Bomenanalyse is filled in the name of the destination dataset. Do you might have an idea what the cause might be?imageimage


dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • December 22, 2022

@scarter​ @Value needs to be capitalized. 

@Value(_first_name)

If you use the attribute value link to input the attribute, it should fill it out correctly. Or you can also use the Open Text Editor.image


joy
Enthusiast
Forum|alt.badge.img+15
  • Author
  • Enthusiast
  • December 22, 2022
dustin wrote:

@scarter​ @Value needs to be capitalized. 

@Value(_first_name)

If you use the attribute value link to input the attribute, it should fill it out correctly. Or you can also use the Open Text Editor.image

Hi @dustin​ the problem was that the information fme_dataset en _first_match was not available, since I just added the output of the stringsearcher to the writer. By using the featuremerger beforehand, therefore all feature got that value and the file could be written to the specifc map and name. Thank you for pointing me in the right direction


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