Skip to main content

I would like to User to rename the output FGDB name every time they run the FME script using the batch file.

I have a FME 2022.2.4 workbench file that output Data on to a FGDB.

FGDB has many feature classes, line points and polygon.

I have created User Parameter called "NAMEFGDB" then linked with the "Writer". When I run the script using workbench or quick translator it prompt and I can change the FGDB name.

However when I run using the batch file, even though I can type the new name for the FGDB, it still writes out to Default database name.

 

My Batch file is as below.

@echo ## Start translation ##

 set /p NAMEFGDB=type fgdb name:

"C:\\Program Files\\FME\\FME2022-1-2\\fme.exe" D:\\GIS\\Data_extract_by_Area.fmw

@echo ## End translation ##

pause

 

Is there anything else I need doing to connect the FME script to batch file?

You need to use the Fanout Dataset option on the writer within the workbench.


Your batch file doesn't appear to be using the parameter.

 

If you run the workspace in Workbench or Quick Translator, using the parameter, check the top of the logfile, it shows the command line that's used, including the parameter. Copy that and paste it in your batch file, making sure the value you originally entered is replaced by the (batchfile!) parameter you're creating with the set command.


thanks, I have selected Fanout Dataset on the writer, unfortunately still writing as the default name, not the name I insert on batch file. (When running the FME script via batch)


Your batch file doesn't appear to be using the parameter.

 

If you run the workspace in Workbench or Quick Translator, using the parameter, check the top of the logfile, it shows the command line that's used, including the parameter. Copy that and paste it in your batch file, making sure the value you originally entered is replaced by the (batchfile!) parameter you're creating with the set command.

Thanks, FME workbench generated command line below.

Do I have to insert all the italic contents on to the batch file?

Do I still have to use set /p command?

 

FME Configuration: Command line arguments are

`C:\\Program Files\\FME\\FME2022-1-2\\fme.exe' `D:/GIS/PROJECTS/nexfibre_Audits_PROD_Gcomms/FME_Scripts_V2\\wb-xlate-1692103595387_4140' `LOG_STANDARDOUT' `YES' `LOG_TIMINGS' `YES' `LogCountServerName' `52798' `LOG_STANDARDOUT' `No' `WORKBENCH_LOG_SERVER' `52796'

 

thanks,

Regards

Pushpa


Thanks, FME workbench generated command line below.

Do I have to insert all the italic contents on to the batch file?

Do I still have to use set /p command?

 

FME Configuration: Command line arguments are

`C:\\Program Files\\FME\\FME2022-1-2\\fme.exe' `D:/GIS/PROJECTS/nexfibre_Audits_PROD_Gcomms/FME_Scripts_V2\\wb-xlate-1692103595387_4140' `LOG_STANDARDOUT' `YES' `LOG_TIMINGS' `YES' `LogCountServerName' `52798' `LOG_STANDARDOUT' `No' `WORKBENCH_LOG_SERVER' `52796'

 

thanks,

Regards

Pushpa

I don't see the parameter being used there, can you share a screenshot of how you have set that up in Workbench?

 

Regardless of that, you do still need the set /p command if you want to use user input


Thanks, FME workbench generated command line below.

Do I have to insert all the italic contents on to the batch file?

Do I still have to use set /p command?

 

FME Configuration: Command line arguments are

`C:\\Program Files\\FME\\FME2022-1-2\\fme.exe' `D:/GIS/PROJECTS/nexfibre_Audits_PROD_Gcomms/FME_Scripts_V2\\wb-xlate-1692103595387_4140' `LOG_STANDARDOUT' `YES' `LOG_TIMINGS' `YES' `LogCountServerName' `52798' `LOG_STANDARDOUT' `No' `WORKBENCH_LOG_SERVER' `52796'

 

thanks,

Regards

Pushpa

thanksImage1


Thanks, FME workbench generated command line below.

Do I have to insert all the italic contents on to the batch file?

Do I still have to use set /p command?

 

FME Configuration: Command line arguments are

`C:\\Program Files\\FME\\FME2022-1-2\\fme.exe' `D:/GIS/PROJECTS/nexfibre_Audits_PROD_Gcomms/FME_Scripts_V2\\wb-xlate-1692103595387_4140' `LOG_STANDARDOUT' `YES' `LOG_TIMINGS' `YES' `LogCountServerName' `52798' `LOG_STANDARDOUT' `No' `WORKBENCH_LOG_SERVER' `52796'

 

thanks,

Regards

Pushpa

Can you also show how you're applying this parameter to your writer?


Thanks, FME workbench generated command line below.

Do I have to insert all the italic contents on to the batch file?

Do I still have to use set /p command?

 

FME Configuration: Command line arguments are

`C:\\Program Files\\FME\\FME2022-1-2\\fme.exe' `D:/GIS/PROJECTS/nexfibre_Audits_PROD_Gcomms/FME_Scripts_V2\\wb-xlate-1692103595387_4140' `LOG_STANDARDOUT' `YES' `LOG_TIMINGS' `YES' `LogCountServerName' `52798' `LOG_STANDARDOUT' `No' `WORKBENCH_LOG_SERVER' `52796'

 

thanks,

Regards

Pushpa

Image2I used "Link to User Parameter" on Writer then from dropdown I selected "NAMEFGDB" User Parameter.

"Prompt for User Parameter" is checked on my workbench. When the script runs via FME workbench or FME quick translator it prompt as below image

Image3So,I am able to change the FGDB name, and the script runs and save the database under new name.

I would like to run the script via batch file. When running via batch file database save under default name. ie: nexfibre.gdb


Thanks, FME workbench generated command line below.

Do I have to insert all the italic contents on to the batch file?

Do I still have to use set /p command?

 

FME Configuration: Command line arguments are

`C:\\Program Files\\FME\\FME2022-1-2\\fme.exe' `D:/GIS/PROJECTS/nexfibre_Audits_PROD_Gcomms/FME_Scripts_V2\\wb-xlate-1692103595387_4140' `LOG_STANDARDOUT' `YES' `LOG_TIMINGS' `YES' `LogCountServerName' `52798' `LOG_STANDARDOUT' `No' `WORKBENCH_LOG_SERVER' `52796'

 

thanks,

Regards

Pushpa

Did you use the Batch Deploy option? If so, don't do that.

 

  1. Run the workspace in Workbench
  2. When it's done, look in the Translation Log panel
  3. At the top of the translation log you will see a section titled "Command line to run this workspace"

It looks something like this:

imageCopy and paste that into your batch file, make sure to put it on a single line and where it currently gives you the fgdb output path put in the parameter you're creating with the set /p command.

 

Keep in mind that you have a FME parameter defined in the workspace that you need to fill with the parameter you're creating with set /p


Thanks, FME workbench generated command line below.

Do I have to insert all the italic contents on to the batch file?

Do I still have to use set /p command?

 

FME Configuration: Command line arguments are

`C:\\Program Files\\FME\\FME2022-1-2\\fme.exe' `D:/GIS/PROJECTS/nexfibre_Audits_PROD_Gcomms/FME_Scripts_V2\\wb-xlate-1692103595387_4140' `LOG_STANDARDOUT' `YES' `LOG_TIMINGS' `YES' `LogCountServerName' `52798' `LOG_STANDARDOUT' `No' `WORKBENCH_LOG_SERVER' `52796'

 

thanks,

Regards

Pushpa

Thanks!

No I didn't use Batch Deploy option.

I have run the workspace in Workbench and copied following lines from Translation log to Batch file.

image4aBatch file is as below.

 

image4b When prompt FileGeoDatabase Name I have input just the word TEST , TEST.gdb and full path and TEST.gdb none of the variations of input works.

Every time Batch File runs it is still creating the FGDB with default name. ie: nexfibre.gdb

 


Thanks, FME workbench generated command line below.

Do I have to insert all the italic contents on to the batch file?

Do I still have to use set /p command?

 

FME Configuration: Command line arguments are

`C:\\Program Files\\FME\\FME2022-1-2\\fme.exe' `D:/GIS/PROJECTS/nexfibre_Audits_PROD_Gcomms/FME_Scripts_V2\\wb-xlate-1692103595387_4140' `LOG_STANDARDOUT' `YES' `LOG_TIMINGS' `YES' `LogCountServerName' `52798' `LOG_STANDARDOUT' `No' `WORKBENCH_LOG_SERVER' `52796'

 

thanks,

Regards

Pushpa

Yes, that's exactly what you're telling it to do.

 

If you replace the "$(FME_MF_DIR_USERTYPED)Output_FGDB\\nexfibre.gdb" with "$NAMEFGDB" I think it should work (it's been a few decades since I've last worked with batch file parameters...)

 

You were setting a parameter in the batch file but you were not actually using it. Just naming it the same as the parameter in the workspace (which I would recommend not doing, as it can be confusing) isn't going to magically make it work.

 

 


Thanks, FME workbench generated command line below.

Do I have to insert all the italic contents on to the batch file?

Do I still have to use set /p command?

 

FME Configuration: Command line arguments are

`C:\\Program Files\\FME\\FME2022-1-2\\fme.exe' `D:/GIS/PROJECTS/nexfibre_Audits_PROD_Gcomms/FME_Scripts_V2\\wb-xlate-1692103595387_4140' `LOG_STANDARDOUT' `YES' `LOG_TIMINGS' `YES' `LogCountServerName' `52798' `LOG_STANDARDOUT' `No' `WORKBENCH_LOG_SERVER' `52796'

 

thanks,

Regards

Pushpa

Thanks, I have changed my Batch file as you suggested, still its writing out under default name.

I thought the Batch file need to have the same name as the User Parameter. I could change that.


Reply