Skip to main content

Hello,

I have a set of node data.

Some of those nodes will have an empty attribute. I am trying to populate them (call it "config") based on previous or next feature.

The condition is should be somewhere along these lines:

If Feature[-1] exists AND Feature [+1] does not exist, then Config = feature[-1].Config

Adversely,

Feature[-1] does not exist AND Feature [+1] exists, then Config = feature[+1].Config

If both exists, then Config = feature[-1].Config.

I am trying to write out the conditional statement and have adjacent feature checked. The conditions only allow for checking if an attribute is null, missing or has an empty string. I don't seem to have any option for the existence of a Feature itself.

Any one have any idea how I can go about that? Thanks!

Hi @fariyafarhad, you should be able to specify the number of prior and subsequent features you want to enable in the AttributeCreator. You can set the values of these attributes created based of the previous and next feature then compare those attributes to populate your config value.


Hi @fariyafarhad, assuming that the number of features is N (N > 2), existence of previous feature and next feature is obvious. i.e.

  • 1st feature: previous feature doesn't exist, next feature exists.

  • 2nd to (N-1)th features: both previous feature and next feature exist.

  • Nth (last) feature: previous feature exists, next feature doesn't exist.

Do you mean this?


Hi @fariyafarhad, assuming that the number of features is N (N > 2), existence of previous feature and next feature is obvious. i.e.

  • 1st feature: previous feature doesn't exist, next feature exists.

  • 2nd to (N-1)th features: both previous feature and next feature exist.

  • Nth (last) feature: previous feature exists, next feature doesn't exist.

Do you mean this?

Hello @takashi,

 

The 1st feature is obvious of course. My problem is not understanding the logic of the problem. But what constitutes a Feature within a conditional statement? I can only check for missing or nonexistent attributes of a feature. But not the existence of a feature itself. In my understanding..
In a conditional value setting, I don't think there is a way to determine directly if previous or next feature exists. However, if you add an attribute that definitely has a value to every feature, you can then determine indirectly if previous or next feature exists through seeing if the attribute in the previous or next features has a value.

 

 

pAddition] This screenshot illustrates my intention.

 


Hi @fariyafarhad, assuming that the number of features is N (N > 2), existence of previous feature and next feature is obvious. i.e.

  • 1st feature: previous feature doesn't exist, next feature exists.

  • 2nd to (N-1)th features: both previous feature and next feature exist.

  • Nth (last) feature: previous feature exists, next feature doesn't exist.

Do you mean this?

In a conditional value setting, I don't think there is a way to determine directly if previous or next feature exists. However, if you add an attribute that definitely has a value to every feature, you can then determine indirectly if previous or next feature exists through seeing if the attribute in the previous or next features has a value.

 

 

pAddition] This screenshot illustrates my intention.

 


Hi @fariyafarhad, assuming that the number of features is N (N > 2), existence of previous feature and next feature is obvious. i.e.

  • 1st feature: previous feature doesn't exist, next feature exists.

  • 2nd to (N-1)th features: both previous feature and next feature exist.

  • Nth (last) feature: previous feature exists, next feature doesn't exist.

Do you mean this?

Alternatively, if you add these two attributes to every feature,

 

  • N: the number of features (StatisticsCalculater)
  • count: 1-based count number (Counter)
you can configure the conditional value like this.

 

  1. If N = 1 Then both previous and next feature don't exist -> Do what?
  2. Else If count = 1 Then previous feature doesn't exist, next feature exists -> new config = featurer+1].config
  3. Else previous feature exists -> new config = featurer-1].config.
To do that, the StatisticsCalculator and the Counter can be used.

 

 

If it's sure that N is always 2 or more, only the 1-based count attribute will be necessary.

 

  • If count = 1 Then previous feature doesn't exist, next feature exists -> new config = featurea+1].config
  • Else previous feature exists -> new config = featurea-1].config

In a conditional value setting, I don't think there is a way to determine directly if previous or next feature exists. However, if you add an attribute that definitely has a value to every feature, you can then determine indirectly if previous or next feature exists through seeing if the attribute in the previous or next features has a value.

 

 

pAddition] This screenshot illustrates my intention.

 

Hi @takashi, thanks for your response. That is a really interesting way to do that. I had a similar thought. was able to do it by exposing fme_dataset and then checking if featureu-1] or featureu+1] had a value in it. I see yours have been selected as the accepted answer already :)

 


Reply