Skip to main content
Solved

Prompt user if value not found


cwarren
Forum|alt.badge.img

I have a work space setup with multiple reader types. One reader will read values from an HTML table to populate attributes within the work space. On rare occasions when reading the HTML table, there will be an empty value from which I currently have the work space set to terminate with a message stating that a certain value was not found.

Is there a way to prompt the user for that certain missing value if not found in the HTML table, instead of just terminating the session like I have it set to now? I know user parameters have to be set before the work space is run, just wanted an idea of how to combat this situation.

FME Desktop 2017 Beta

 

Best answer by imapping

My solution for prompting the user for input during the run is:

1. Have a SystemCaller running;

start /wait cmd.exe /k "c:\\temp\\fmeprompt.bat"

2. The fmeprompt.bat file is:

@echo off

 

set Output="c:\\temp\\fmeprompt.txt"

 

del %Output%

 

set /p VarOne=Enter variable one value:

 

set /p VarTwo=Enter variable two value:

 

set /p VarThree=Enter variable three value:

 

set /p VarFour=Enter variable four value:

 

 

REM enter your desired output here

 

echo Variable One = %VarOne% >> %Output%

 

echo Variable Two = %VarTwo% >> %Output%

 

echo Variable Three = %VarThree% >> %Output%

 

echo Variable Four = %VarFour% >> %Output%

 

 

echo.

 

echo File has been placed %Output%

 

 

exit

3. Use a FeatureReader to read in fmeprompt.txt and process the results input by the user.

 

View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • November 1, 2016

Hi @madwarren as you state yourself this will probably wont be possible in one workspace, but possibly by catching the empty value and using it in a second workspace, where the user can set the value, is a possible way to treat such situations.

Hope this helps


Forum|alt.badge.img
  • November 2, 2016

I'm not sure exactly how it would be implemented but could a SystemCaller be used to get the input from the user through running a batch file?


Forum|alt.badge.img
  • November 2, 2016
imapping wrote:

I'm not sure exactly how it would be implemented but could a SystemCaller be used to get the input from the user through running a batch file?

I was able to do a quick proof of concept using the SystemCaller to open up a command window running a batch file that asked for user input. That input was saved to a text file which was read in by a FeatureReader.

 

 

At the moment it's messy and using a decelerator to give time for the user to input the response rather than knowing when the batch file has finished but I'll work on it some more.

 

 


Forum|alt.badge.img
  • Best Answer
  • November 2, 2016

My solution for prompting the user for input during the run is:

1. Have a SystemCaller running;

start /wait cmd.exe /k "c:\\temp\\fmeprompt.bat"

2. The fmeprompt.bat file is:

@echo off

 

set Output="c:\\temp\\fmeprompt.txt"

 

del %Output%

 

set /p VarOne=Enter variable one value:

 

set /p VarTwo=Enter variable two value:

 

set /p VarThree=Enter variable three value:

 

set /p VarFour=Enter variable four value:

 

 

REM enter your desired output here

 

echo Variable One = %VarOne% >> %Output%

 

echo Variable Two = %VarTwo% >> %Output%

 

echo Variable Three = %VarThree% >> %Output%

 

echo Variable Four = %VarFour% >> %Output%

 

 

echo.

 

echo File has been placed %Output%

 

 

exit

3. Use a FeatureReader to read in fmeprompt.txt and process the results input by the user.

 


cwarren
Forum|alt.badge.img
  • Author
  • November 2, 2016
imapping wrote:

My solution for prompting the user for input during the run is:

1. Have a SystemCaller running;

start /wait cmd.exe /k "c:\\temp\\fmeprompt.bat"

2. The fmeprompt.bat file is:

@echo off

 

set Output="c:\\temp\\fmeprompt.txt"

 

del %Output%

 

set /p VarOne=Enter variable one value:

 

set /p VarTwo=Enter variable two value:

 

set /p VarThree=Enter variable three value:

 

set /p VarFour=Enter variable four value:

 

 

REM enter your desired output here

 

echo Variable One = %VarOne% >> %Output%

 

echo Variable Two = %VarTwo% >> %Output%

 

echo Variable Three = %VarThree% >> %Output%

 

echo Variable Four = %VarFour% >> %Output%

 

 

echo.

 

echo File has been placed %Output%

 

 

exit

3. Use a FeatureReader to read in fmeprompt.txt and process the results input by the user.

 

 

Thanks @imapping I'll give it a go.. Thanks for your help!

 


Forum|alt.badge.img
  • November 3, 2016
imapping wrote:

My solution for prompting the user for input during the run is:

1. Have a SystemCaller running;

start /wait cmd.exe /k "c:\\temp\\fmeprompt.bat"

2. The fmeprompt.bat file is:

@echo off

 

set Output="c:\\temp\\fmeprompt.txt"

 

del %Output%

 

set /p VarOne=Enter variable one value:

 

set /p VarTwo=Enter variable two value:

 

set /p VarThree=Enter variable three value:

 

set /p VarFour=Enter variable four value:

 

 

REM enter your desired output here

 

echo Variable One = %VarOne% >> %Output%

 

echo Variable Two = %VarTwo% >> %Output%

 

echo Variable Three = %VarThree% >> %Output%

 

echo Variable Four = %VarFour% >> %Output%

 

 

echo.

 

echo File has been placed %Output%

 

 

exit

3. Use a FeatureReader to read in fmeprompt.txt and process the results input by the user.

 

prompt-user-for-input-during-workflow.fmw

 

 

@madWarren Here's a workspace (2017 beta) that shows my idea in action.

 

 


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