Skip to main content
Solved

Help with Adjacent Feature Attributes

  • February 12, 2019
  • 6 replies
  • 235 views

mmccart
Supporter
Forum|alt.badge.img+17

I am trying to leverage the 'Adjacent Feature Attributes' function in AttributeManager to generate a list of unique IDs (UID) for a set of records. In this example I have generated a UID for a single record based on if the record in 'col0' contains a "G" and concatenating the CSV Line Number with 'col2' (this is a timestamp, so I removed the colons to avoid issues down the line).

 

I now want to replicate that _UID_G field to the other records until I hit another 'G' type record to ultimately look like this:

 

Here is my issue: the number of CSV Lines between records that have 'G' in col0 can fluctuate for each CSV that I run. I am trying to dynamically set the Number for Prior Features in the AttributeManager:

 

 

I think I need to build a list from the CSV file I am using first, then figure out how to count the number of records that exist between each "G" feature. From there I can use a TestFilter and address each unique number of records. How can I do this?

I tried ListElementCounter and it returns everything.

 

In the CSV I am running, there are only 9 records between each 'G' feature. But it could fluctuate between 8 and 12 in other CSV files that I run.

I need this UID to perform joins on data after I define each attribute based on the Letter in col0. Each letter record has a unique number of fields. Is there a better way to do this?

Thanks!

Best answer by ebygomm

You don't need to know how many lines there are between each feature as the features are processed in order. If the first feature has a value, then the second feature gets that value if you are looking at one previous feature. When it comes to the third feature, the second feature now has a value so again, only a need to look at the previous feature. The fourth feature can then look for the value in the third feature and so on

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

6 replies

ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • Best Answer
  • February 12, 2019

You don't need to know how many lines there are between each feature as the features are processed in order. If the first feature has a value, then the second feature gets that value if you are looking at one previous feature. When it comes to the third feature, the second feature now has a value so again, only a need to look at the previous feature. The fourth feature can then look for the value in the third feature and so on


mmccart
Supporter
Forum|alt.badge.img+17
  • Author
  • Supporter
  • February 12, 2019
ebygomm wrote:

You don't need to know how many lines there are between each feature as the features are processed in order. If the first feature has a value, then the second feature gets that value if you are looking at one previous feature. When it comes to the third feature, the second feature now has a value so again, only a need to look at the previous feature. The fourth feature can then look for the value in the third feature and so on

@egomm I'm not tracking here. Do you have an example?

Here is my attribute manager and the Conditional Statement to create the "_UID_others" field:

This set-up returns this:

 

How do I set the value of "_UID_Others" for Rows 3-10 "14_162127" and set the value of "_UID_others" for Rows 13-20 to "24_162133", etc.?

The only way i could do it was by setting the 'Number of Prior Features" to '9' like this:

Which gives me the result seen up above in the adjacentvalues-example3.png screenshot I posted earlier.

Is there something wrong with my conditional statement?

Thanks.

 


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • February 12, 2019

@mmccart

 

You can also use a variable retriever after testing for value "G" followed by a variableretriever.


ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • February 12, 2019
mmccart wrote:

@egomm I'm not tracking here. Do you have an example?

Here is my attribute manager and the Conditional Statement to create the "_UID_others" field:

This set-up returns this:

 

How do I set the value of "_UID_Others" for Rows 3-10 "14_162127" and set the value of "_UID_others" for Rows 13-20 to "24_162133", etc.?

The only way i could do it was by setting the 'Number of Prior Features" to '9' like this:

Which gives me the result seen up above in the adjacentvalues-example3.png screenshot I posted earlier.

Is there something wrong with my conditional statement?

Thanks.

 

adjacent_attribute_population.fmwt

Example with some mocked up data


mmccart
Supporter
Forum|alt.badge.img+17
  • Author
  • Supporter
  • February 12, 2019
gio wrote:

@mmccart

 

You can also use a variable retriever after testing for value "G" followed by a variableretriever.

@gio I tried the VariableSetter and VariableRetriever and no luck. If you had an example, that would be appreciated.

Thanks.


mmccart
Supporter
Forum|alt.badge.img+17
  • Author
  • Supporter
  • February 12, 2019
ebygomm wrote:

adjacent_attribute_population.fmwt

Example with some mocked up data

Thanks @egomm! That worked!


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