Hi @dane_stephenson
Would the
ModuloCounter transformer work for you?
Or perhaps using
adjacant features to count, and when it gets to 12 assign a new id value.
Hi @dane_stephenson
Would the
ModuloCounter transformer work for you?
Or perhaps using
adjacant features to count, and when it gets to 12 assign a new id value.
I do not think that the ModuloCounter will work in this case because I need the first 12 to receive the same value (0) and then the next 12 to receive the same value (1), etc. in sets of 12 until we reach the end of that relational group and then start over again at 0.
As for the Adjacent Features parameter of the Attribute Manager, I am not exactly sure how I would go about implementing the above using that option.
Hi @dane_stephenson, if I understand the requirement correctly, this arithmetic expression returns your desired group index. Assuming the attribute "_count" stores sequential number starting with 0.
@int(@Value(_count) % 144 / 12)
a part of result table:
Hi @dane_stephenson, if I understand the requirement correctly, this arithmetic expression returns your desired group index. Assuming the attribute "_count" stores sequential number starting with 0.
@int(@Value(_count) % 144 / 12)
a part of result table:
@takashi This is helpful, but the number of records in a relational set is not always 144. In the example I gave, there were three relational sets in the total 360 records, two with 144 records and 1 with 72. They can range from 72 to 864 records in a set. They are however, always a multiple of 12.
Hi @dane_stephenson, if I understand the requirement correctly, this arithmetic expression returns your desired group index. Assuming the attribute "_count" stores sequential number starting with 0.
@int(@Value(_count) % 144 / 12)
a part of result table:
Do the records have a common attribute that can be used to identify each relational set?
If they have such an attribute, you can set it to the Counter Name parameter in a Counter to generate sequential numbers starting with 0 for each set. You can then calculate group index with the expression "@int(@Value(_count)/12)".
Do the records have a common attribute that can be used to identify each relational set?
If they have such an attribute, you can set it to the Counter Name parameter in a Counter to generate sequential numbers starting with 0 for each set. You can then calculate group index with the expression "@int(@Value(_count)/12)".
Yes, they do. Regardless of whether the relational set is 72, 144, or 864 records, they all have the same CABLEIDFKEY value. I will give this suggestion a go and get back to you.
I think what you need here is a combination of Counter and ModuloCounter.
- Set a Counter with the Counter Name set to the ID attribute
- Set a ModuloCounter to count in groups of 12
- Add an AttributeManager/ExpressionEvaluator to subtract the Modulo count value from the Count value
This will give you the group value that you need. The only drawback you have is that the values will not be 1,2,3,4. They will be 1,13,25,37,etc. But it will be unique and I am sure there must be a way to renumber those to a sequential count.
The Count-Modulo concept is something I often find useful and it is certainly worth being aware of.
Hope this helps.
I think what you need here is a combination of Counter and ModuloCounter.
- Set a Counter with the Counter Name set to the ID attribute
- Set a ModuloCounter to count in groups of 12
- Add an AttributeManager/ExpressionEvaluator to subtract the Modulo count value from the Count value
This will give you the group value that you need. The only drawback you have is that the values will not be 1,2,3,4. They will be 1,13,25,37,etc. But it will be unique and I am sure there must be a way to renumber those to a sequential count.
The Count-Modulo concept is something I often find useful and it is certainly worth being aware of.
Hope this helps.
@Mark2AtSafe I ended up following @takashi advice above. I added a Counter with the Counter Name pointed at the unique relational ID I spoke of. I then added an AttributeManager field that calculated a new value with the following @int(@Value(_FPT)/12) where _FTP is the Output Attribute from the Counter. This gave me groups of 12 assigned with each record being assigned a value of 0, then 1, etc. Because I needed the grouping to begin at 1 and not 0, I then added another field that calculated a value with the following @add(@int(@Value(R_group_index)),1) where R_group_index is the grouping index created previously. This got the job done. It handles any number of relational groups and with any multiple of 12 records within that relational group.