Skip to main content

I have a FME 2022 Script that run against an Oracle Database and extract list of boundaries and output on to a FGDB. I would like to let User to run the script using a bat file, rather than intervene with the Script on FME workbench. I have a list of boundary IDs on an Excel that attached to the script then User can extract boundaries on the excel sheet. But I would like User to extract any boundaries begins with boundary ID ie: "AA-X-BB"

I would like some help to understand how to write the script that the bat file extract all the boundaries begins with my ID rather than a single boundary.

Any help would be appreciated.

thanks

Pushpa

You'll want to use the set command.

 

From https://commandwindows.com/batch.htm:

 

You can also interact with a user and ask that data be entered. The old DOS had a "Choice" command for very limited interaction but that has been superseded in Windows XP/Vista by the more versatile "set /p". The syntax is:

set /p variable= >string]

"Variable" is the name of the variable that will be assigned to the data that you want the user to input. "String" is the message that the user will see as a prompt. If desired, "string" can be omitted. Here is an example that asks the user to enter his or her name:

set /p name= What is your name?

This will create a variable %name% whose value is whatever the user enters. Note that the user must press the "Enter' key after typing the input.

 

Combine this with the Batch Processing Method 1: Command Line or Batch File article.

 

The important thing to keep in mind is that fme.exe is no longer included in the PATH environment variable, so you'll have to use an absolute path to fme.exe

 

You will need to publish a parameter in the workspace to receive the boundary name, and then use that in a Tester or a where clause on the reader.

 


You'll want to use the set command.

 

From https://commandwindows.com/batch.htm:

 

You can also interact with a user and ask that data be entered. The old DOS had a "Choice" command for very limited interaction but that has been superseded in Windows XP/Vista by the more versatile "set /p". The syntax is:

set /p variable= >string]

"Variable" is the name of the variable that will be assigned to the data that you want the user to input. "String" is the message that the user will see as a prompt. If desired, "string" can be omitted. Here is an example that asks the user to enter his or her name:

set /p name= What is your name?

This will create a variable %name% whose value is whatever the user enters. Note that the user must press the "Enter' key after typing the input.

 

Combine this with the Batch Processing Method 1: Command Line or Batch File article.

 

The important thing to keep in mind is that fme.exe is no longer included in the PATH environment variable, so you'll have to use an absolute path to fme.exe

 

You will need to publish a parameter in the workspace to receive the boundary name, and then use that in a Tester or a where clause on the reader.

 

thank you!


You'll want to use the set command.

 

From https://commandwindows.com/batch.htm:

 

You can also interact with a user and ask that data be entered. The old DOS had a "Choice" command for very limited interaction but that has been superseded in Windows XP/Vista by the more versatile "set /p". The syntax is:

set /p variable= >string]

"Variable" is the name of the variable that will be assigned to the data that you want the user to input. "String" is the message that the user will see as a prompt. If desired, "string" can be omitted. Here is an example that asks the user to enter his or her name:

set /p name= What is your name?

This will create a variable %name% whose value is whatever the user enters. Note that the user must press the "Enter' key after typing the input.

 

Combine this with the Batch Processing Method 1: Command Line or Batch File article.

 

The important thing to keep in mind is that fme.exe is no longer included in the PATH environment variable, so you'll have to use an absolute path to fme.exe

 

You will need to publish a parameter in the workspace to receive the boundary name, and then use that in a Tester or a where clause on the reader.

 

Hi Ryan,

Thanks for the information provided, it was very useful. However I found another way to select all smaller boundaries within Larger boundaries rather than inputting the individual IDs by User.

 

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

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 bat file, even though I 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 to be doing to connect the FME script to batch file?

 

thanks,

Regards,

Pushpa


Hi Ryan,

Thanks for the information provided, it was very useful. However I found another way to select all smaller boundaries within Larger boundaries rather than inputting the individual IDs by User.

 

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

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 bat file, even though I 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 to be doing to connect the FME script to batch file?

 

thanks,

Regards,

Pushpa

Sorry for the late reply. You'll have to add the parameter value to the FME.exe command:

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


Reply