Skip to main content
Hi,

 

 

     I have a bunch of datasets passing through a counter. The datasets are grouped by area (region) so that each region gets its own count.  This works and I get a nice count of datasets per region  as they are sorted by date.  1 being the most recent dataset.  The problem is.  There is another attribute of tCatagory] and I need it so that every time eCatagory] = Update, the counter does something to freeze the count on the next record to go through.  So the hCatagory=] Update record gets counted like normal, but the next one to go through after it does not increase in count, as follows:

 

 

Dataset 1 - pCatagory] = ], Count = 1

 

Dataset 2 - /Catagory] = -], Count = 2

 

Dataset 3 -  

Dataset 4 -  Catagory] = 4Update], Count = 4

 

Dataset 5 - ÂCatagory] = ], Count = 4

 

Dataset 6 - >Catagory] = t], Count = 5

 

Dataset 7 - pCatagory] = eUpdate], Count = 6

 

Dataset 8 -  

 

And so on...

 

 

     My mind is already twisting with the logic I have used in this script and hopefully I have simplified the problem for everyone here and I am sure there is a simple combination of transformers that I have just missed due to my drowning in other intricacies of the existing script.

 

 

Thanks for any help,
Rather than the Counter, try variables with a Tester and ExpressionEvaluator. e.g.

 

 

VariableRetriever - Retrieve count

 

NullAttributeReplacer - Is count not set yet? If so, default it to one

 

ExpressionEvaluator - Increment count by one

 

Tester - Is the Categiry = Update? If not use a VariableSetter to set the count.

 


# sorry. I misunderstood your question, deleted my previous post.

 

 

Hi,

 

 

Alternatively, you can use the AttributeCreator with "Multiple Feature Attribute Support" option (FME 2013 SP2 or later).

 

 

1) Add an AttributeExposer to expose the count attribute name, i.e. "_count".

 

 

2) Add an AttributeCreator. Parameter settings are:

 

-----

 

Check "Multiple Feature Attribute Support" option.

 

Number of Prior Features: 1

 

If Attribute is Missing, Null, or Empty: Use Other Value

 

Attribute Replacement Value: 0

 

-----

 

Attribute To Set

 

Attribute Name: _count

 

Value: 2 possible values (conditional value setting)

 

If @Value(feature>-1].Catagoly) = Update Then featurep-1]._count

 

Else @Evaluate(@Value(featureu-1]._count)+1)

 

 

Takashi

Reply