Question

In FME server, how to present feature(ids/names) in an HTML dropdown so user can have chosen feature processed by workspace ?

  • 7 February 2022
  • 3 replies
  • 8 views

Badge

I'm tasked to create a webpage, that will present the user a list (about 15 long) of polygon "things" with unique name. after the user selects a "thing" I will need to generate a list of postal codes that overlap that polygon "thing". The things are temporary, so the list changes in time. I get the feeling that I need to create 2 workspaces, one producing the list of features to be used in the dropdown, then another to process the selected feature. But I'm afraid I might be overthinking this ? surely this is an often-encountered scenario ? I have not found any example using actual data in input parameters, just static enumerations. I'd love to hear which general approach fits my requirement best.

Regards,

Ronald


3 replies

Userlevel 2
Badge +17

Hi @raalst​,

I think you will need two workspaces as well:

The first workspace (MakeDropdown.fmw) will read the list of polygons from its data source, then produce an HTML form with a dropdown list. The Submit button in this form will call the second workspace.

Screen Shot 2022-02-07 at 2.35.51 PMThe second workspace (MakeReport.fmw) will extract the polygon name from the dropdown, then read that polygon from the source data and find the intersecting zip codes. It will produce an HTML report to stream back to the user.

Screen Shot 2022-02-07 at 2.39.44 PMThe MakeReport workspace should published to FME Server first and associated with the data streaming service. Next, create a token for the workspace from the FME Server interface by clicking on the user icon on the upper left and choosing Manage Tokens.

Screen Shot 2022-02-07 at 2.43.50 PMCreate an API token to Run the Repository you added the workspace to, with a long expiry (ie. several months or a year). Copy the token to the clipboard.

 

Edit the first workspace and add both the path and token to the second workspace to the appropriate values in the AttributeCreator with yellow annotation. The path to the workspace will be in the form:

http://<server_name>/fmedatastreaming/<repository_name>/MakeReport.fmw

 

Save the workspace and publish to the Data Streaming Service.

 

In the FME Server interface, navigate to the MakeDropdown workspace, then create a Server app for it so it can be used without logging into FME Server. Running this web app in a browser should result in the dropdown web page. Choosing the appropriate polygon and clicking Submit should result in another web page listing the intersecting zip codes.

 

I am attaching initial versions of the two workspaces. They will need to be adjusted to read from your datasets.

Userlevel 2
Badge +17

Hi @raalst​,

I think you will need two workspaces as well:

The first workspace (MakeDropdown.fmw) will read the list of polygons from its data source, then produce an HTML form with a dropdown list. The Submit button in this form will call the second workspace.

Screen Shot 2022-02-07 at 2.35.51 PMThe second workspace (MakeReport.fmw) will extract the polygon name from the dropdown, then read that polygon from the source data and find the intersecting zip codes. It will produce an HTML report to stream back to the user.

Screen Shot 2022-02-07 at 2.39.44 PMThe MakeReport workspace should published to FME Server first and associated with the data streaming service. Next, create a token for the workspace from the FME Server interface by clicking on the user icon on the upper left and choosing Manage Tokens.

Screen Shot 2022-02-07 at 2.43.50 PMCreate an API token to Run the Repository you added the workspace to, with a long expiry (ie. several months or a year). Copy the token to the clipboard.

 

Edit the first workspace and add both the path and token to the second workspace to the appropriate values in the AttributeCreator with yellow annotation. The path to the workspace will be in the form:

http://<server_name>/fmedatastreaming/<repository_name>/MakeReport.fmw

 

Save the workspace and publish to the Data Streaming Service.

 

In the FME Server interface, navigate to the MakeDropdown workspace, then create a Server app for it so it can be used without logging into FME Server. Running this web app in a browser should result in the dropdown web page. Choosing the appropriate polygon and clicking Submit should result in another web page listing the intersecting zip codes.

 

I am attaching initial versions of the two workspaces. They will need to be adjusted to read from your datasets.

Looks like the second workspace wasn't attached. Here it is.

Badge

thanks !

I was not aware I could generate the whole page, I was assuming I had to call both workspaces via RESTAPI (like in the dynamic form example).

 

Reply