Skip to main content

I am looking for the equivalent of ArcGIS ModelBuilder's "precondition." I am using the AttributeExposer transformer and I need to enter a table that contains all the values I want to use for the attribute names.

The names come from a field in the input table, and I don't know how many there will be beforehand, so I need to generate a table which is then read by the AttributeExposer.

Is there any way to ensure the AttributeExposer does not try to run before this table has been created?

Since the table is created with a writer, there is no output for me to plug into the AttributeExposer - It is a "dead end" on a different branch.

Thank you,

Randy McGregor

This could be done, if you use a FeatureWriter transformer instead of a writer.

The FeatureWriter is a transformer with an output port, but it acts the same way as the writer.

Hope this helps.


This could be done, if you use a FeatureWriter transformer instead of a writer.

The FeatureWriter is a transformer with an output port, but it acts the same way as the writer.

Hope this helps.

Thanks! Unfortunately, I was mistaken. Using that output as a DIRECT input to the AttributeExposer does not help me. I need a different table input into that transformer, so I still need a way to ensure that it doesn't run until the table is created.

 

The table is used to input the attribute names with the "import table" option and that option doesn't seem to lend itself to direct input (that I can see).

For now, I just run the branch that creates the table first, then run the other branch. Works, but it won't work when batched.

Appreciate the response.

 

Randy McGregor


This comes down to the flow of features through a workspace, and how you can cause one stream to fire before another. There are several ways.

If you are reading from two different readers (say a CSV reader to the FeatureWriter, then an Excel reader to the AttributeExposer, etc) then you can make sure that the CSV reader fires first by making it uppermost in the Navigator window. That may make a difference.

Otherwise, if the two streams are coming out of the same reader or transformer output port, you can right-click on that port and choose the Connection Runtime Order option to set what order the actions happen.

However, often the interaction of transformers and connections in a workspace renders the reader order invalid by the time you get to the important part. So, what I would do here is simply add a transformer that needs input from both streams, but can cope with one stream missing and be made to do nothing.

For example, if you put a FeatureJoiner transformer into your workspace - connect the FeatureWriter to the Right port and the other set of data to the Left port - then the stream of data going into the AttributeExposer will have to wait until the FeatureWriter has provided a join input. It doesn't actually matter if there is no join, because you can use the UnjoinedLeft port to get the output.

Does this help? I might see if I can make a custom transformer to make FME "wait" for input like this, and add it to the FME Hub so that users in this scenario have a transformer to use.


Thanks! Unfortunately, I was mistaken. Using that output as a DIRECT input to the AttributeExposer does not help me. I need a different table input into that transformer, so I still need a way to ensure that it doesn't run until the table is created.

 

The table is used to input the attribute names with the "import table" option and that option doesn't seem to lend itself to direct input (that I can see).

For now, I just run the branch that creates the table first, then run the other branch. Works, but it won't work when batched.

Appreciate the response.

 

Randy McGregor

Hi Randy,

Another option would be separating the 2 branches into 2 workspaces and then use a Workspacerunner to run both in sequence.

Hope that helps.


I created a hub transformer that may help here: https://hub.safe.com/publishers/safe-lab/transformers/sequencecontroller


This comes down to the flow of features through a workspace, and how you can cause one stream to fire before another. There are several ways.

If you are reading from two different readers (say a CSV reader to the FeatureWriter, then an Excel reader to the AttributeExposer, etc) then you can make sure that the CSV reader fires first by making it uppermost in the Navigator window. That may make a difference.

Otherwise, if the two streams are coming out of the same reader or transformer output port, you can right-click on that port and choose the Connection Runtime Order option to set what order the actions happen.

However, often the interaction of transformers and connections in a workspace renders the reader order invalid by the time you get to the important part. So, what I would do here is simply add a transformer that needs input from both streams, but can cope with one stream missing and be made to do nothing.

For example, if you put a FeatureJoiner transformer into your workspace - connect the FeatureWriter to the Right port and the other set of data to the Left port - then the stream of data going into the AttributeExposer will have to wait until the FeatureWriter has provided a join input. It doesn't actually matter if there is no join, because you can use the UnjoinedLeft port to get the output.

Does this help? I might see if I can make a custom transformer to make FME "wait" for input like this, and add it to the FME Hub so that users in this scenario have a transformer to use.

Thank you. I will look into this. I appreciate the information.


Hi Randy,

Another option would be separating the 2 branches into 2 workspaces and then use a Workspacerunner to run both in sequence.

Hope that helps.

I think this is my best bet as it is the only way to guarantee that one process finishes before the one dependent on it starts.

It is incredibly slow, though. The first workspace take about 30 seconds on its own, but when run though the workspace runner it takes several minutes.

It would be awfully nice if FME could create a precondition transformer (hint hint).

Thanks for your help. I will give you the credit just as soon as I can get it to work.


I think this is my best bet as it is the only way to guarantee that one process finishes before the one dependent on it starts.

It is incredibly slow, though. The first workspace take about 30 seconds on its own, but when run though the workspace runner it takes several minutes.

It would be awfully nice if FME could create a precondition transformer (hint hint).

Thanks for your help. I will give you the credit just as soon as I can get it to work.

Oookay, it's slow because it's running the input workspace once for each feature in the input of the workspace calling it.

There are over 3,000, and that's not one of the larger tables.

I just need to run that workspace as is - The workspace itself has an input and I think they are doubling up (or 3,000ing up...).

If I could run the workspace runner without an input, that would be great, but that appears not to be an option.


You can use a Sampler to run the workspace with just the first feature.

But best would be creating a Runner workspace, using a dummy feature from a Creator transformer that kicks off the first and second workspace (once):

Hope that helps.


Oookay, it's slow because it's running the input workspace once for each feature in the input of the workspace calling it.

There are over 3,000, and that's not one of the larger tables.

I just need to run that workspace as is - The workspace itself has an input and I think they are doubling up (or 3,000ing up...).

If I could run the workspace runner without an input, that would be great, but that appears not to be an option.

You can use a Sampler to run the workspace with just the first feature.

But best would be creating a Runner workspace, using a dummy feature from a Creator transformer that kicks off the first and second workspace (once):

Hope that helps.


You can use a Sampler to run the workspace with just the first feature.

But best would be creating a Runner workspace, using a dummy feature from a Creator transformer that kicks off the first and second workspace (once):

Hope that helps.

Thank you. I was misunderstanding this process. I now have three fme workspaces:

1. Creates the list

2. Creates the output features using the list from 1 to expose attributes.

3. Runs the two workspace runners.


You can use a Sampler to run the workspace with just the first feature.

But best would be creating a Runner workspace, using a dummy feature from a Creator transformer that kicks off the first and second workspace (once):

Hope that helps.

This is the correct answer, but I don't see an "Accept" option. There is an accept option up above where you recommended the feature writer, but that wasn't quite the answer.


This is the correct answer, but I don't see an "Accept" option. There is an accept option up above where you recommended the feature writer, but that wasn't quite the answer.

I will convert the right answer to an answer on the question.


I created a hub transformer that may help here: https://hub.safe.com/publishers/safe-lab/transformers/sequencecontroller

Thanks, but I need this transformer to be able to run under a variety of conditions and custom transformers are discouraged.

Can a network location be identified as with database and web connections?

Thank you,

 

Randy


Reply