Skip to main content
Solved

iterating/looping a workspace using attribute values


helentait
Forum|alt.badge.img

I have a fairly large workbench that uses quite a bit of processing muscle, so I am limiting which features are processed at one time by using an attribute value (a line reference) exposed as a published parameter i.e each time I run the workspace, I enter a new line reference to be processed. I have about 1500 different line references to process. How can I automate this so that I don't have to manually enter each new line reference?

Best answer by 1spatialmary

@helentair - take a look at the WorkspaceRunner transformer, this will run your process as a second workspace based on the values you pass from the first one (your attribute values). Another option is to use a .bat file with the command line text to run the workspace for each parameter value replicated for each changing value of your attribute.

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

12 replies

david_r
Evangelist
  • December 7, 2017

You could consider using a parent workspace with a WorkspaceRunner to batch run your exising workspace.

Here's a starting point for more information: https://knowledge.safe.com/articles/1469/batch-processing-using-the-workspacerunner-1.html


Forum|alt.badge.img+1
  • Best Answer
  • December 7, 2017

@helentair - take a look at the WorkspaceRunner transformer, this will run your process as a second workspace based on the values you pass from the first one (your attribute values). Another option is to use a .bat file with the command line text to run the workspace for each parameter value replicated for each changing value of your attribute.


lau
Forum|alt.badge.img+3
  • December 7, 2017
Can you make your groups in a first workspace and use a WorkspaceRunner to run your groups separately?

 

 


helentait
Forum|alt.badge.img
  • Author
  • December 7, 2017
david_r wrote:

You could consider using a parent workspace with a WorkspaceRunner to batch run your exising workspace.

Here's a starting point for more information: https://knowledge.safe.com/articles/1469/batch-processing-using-the-workspacerunner-1.html

But how do I pass in the different attribute values? That example uses different inputs each time via the directory reader. I have exactly the same data inputs each time, but want to restrict each run to a subset of data using an attribute value.

 

 


helentait
Forum|alt.badge.img
  • Author
  • December 7, 2017
1spatialmary wrote:

@helentair - take a look at the WorkspaceRunner transformer, this will run your process as a second workspace based on the values you pass from the first one (your attribute values). Another option is to use a .bat file with the command line text to run the workspace for each parameter value replicated for each changing value of your attribute.

Thanks, but I am still struggling with how I actually automatically pass through a different attribute value each time.

 

 


david_r
Evangelist
  • December 7, 2017
helentait wrote:
But how do I pass in the different attribute values? That example uses different inputs each time via the directory reader. I have exactly the same data inputs each time, but want to restrict each run to a subset of data using an attribute value.

 

 

You create one or more published parameters in the child workspace, these parameters will be available to you in the master workspace and you can map them to attribute values. It should be explained in the article I linked.

helentait
Forum|alt.badge.img
  • Author
  • December 7, 2017
david_r wrote:

You could consider using a parent workspace with a WorkspaceRunner to batch run your exising workspace.

Here's a starting point for more information: https://knowledge.safe.com/articles/1469/batch-processing-using-the-workspacerunner-1.html

I'm probably being a bit thick, but I don't think that example helps. It uses a directory reader to iterate through the input files. I want to be able to iterate through values for a particular attribute. I have created the published parameter in the workspace - which I am manually changing each time at the moment - but how do I pass it a different attribute each time? In the example, the iteration is being done by the directory reader - but that won't work for my problem.

 

 


helentait
Forum|alt.badge.img
  • Author
  • December 7, 2017
1spatialmary wrote:

@helentair - take a look at the WorkspaceRunner transformer, this will run your process as a second workspace based on the values you pass from the first one (your attribute values). Another option is to use a .bat file with the command line text to run the workspace for each parameter value replicated for each changing value of your attribute.

ok, I think I have it working and it was a lot simpler than I thought. Thanks.

 

 


helentait
Forum|alt.badge.img
  • Author
  • December 7, 2017
david_r wrote:

You could consider using a parent workspace with a WorkspaceRunner to batch run your exising workspace.

Here's a starting point for more information: https://knowledge.safe.com/articles/1469/batch-processing-using-the-workspacerunner-1.html

Ditto my comment above - I think I have it working with a workspace runner, and a file containing the attribute values I want - passing these through to the published parameter. Thanks

 

 


Forum|alt.badge.img

@helentait - can you explain how you got it to work? I'm trying to do the exact same thing. Thanks.


helentait
Forum|alt.badge.img
  • Author
  • May 3, 2018
janejane211 wrote:

@helentait - can you explain how you got it to work? I'm trying to do the exact same thing. Thanks.

Hi, yes @janejane211. So I set up my main workspace and set up a published user parameter for the value that I want to change each time.

 

 

I have a csv containing all the values I want to use for the published parameter, each as a separate record/row.

 

 

I then created another workspace that reads in the csv file. This is connected to a workspace runner. In the parameters for the workspace runner, choose your main workspace that you want to run. The published user parameters from the main workspace should also appear. Here you can choose the attribute from your csv file

 

Hope that makes sense.

Forum|alt.badge.img
helentait wrote:
Hi, yes @janejane211. So I set up my main workspace and set up a published user parameter for the value that I want to change each time.

 

 

I have a csv containing all the values I want to use for the published parameter, each as a separate record/row.

 

 

I then created another workspace that reads in the csv file. This is connected to a workspace runner. In the parameters for the workspace runner, choose your main workspace that you want to run. The published user parameters from the main workspace should also appear. Here you can choose the attribute from your csv file

 

Hope that makes sense.

 

Yes, Thank you!

 


Reply


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