Best option would be a list builder.
Grouping by your site designation
Â
Use the sorter beforehand to get them in order if needed
Based on the data you will need to group on both B-Side Designation and Sheath Code 1 in the ListBuilder that darkspatiallord suggested, and of course put Sheath Code 1 Fibre No as Selected Attribute. Then follow the ListBuilder with a ListSorter to get your Fibre numbers in order and finish off with a ListConcatenator to get your fibre numbers in a nice row.
The last problem is to go from F001,F002,F003,F004,F030,F031,F049,F050 to F001-F004,F030-F031,F049-F050. You'll need some way to find out which fibre numbers are consecutive in each row and remove the ones in between the first and last in each group.
The range bit is the tricky bit, especially because the original values are alphanumeric, I'm sure it's doable in FME only but this sort of thing is easier in python. So extract the numbers, build a list, use some python to create ranges from the list
import fme
import fmeobjects
from operator import itemgetter
from itertools import groupby
def getRanges(feature):
   Â
    data = list(map(int,feature.getAttribute('_list{}.fibre_number_only')))
    ranges = t]
    for k, g in groupby(enumerate(data), lambda (i,x):i-x):
        group = map(itemgetter(1), g)
        if groupd0]==groupi-1]:
            ranges.append('F'+str(groupr0]).zfill(3))
        else:
            ranges.append('F'+str(group 0]).zfill(3)+'-F'+str(group[-1]).zfill(3))
    feature.setAttribute('Ranges',','.join(ranges))
Create_ranges.fmwt
Thanks everyone's answer. I used Listbuilder group by B-Side Designation, then ListConcatenator of each Sheath Code (actually it could up to 30 sheaths per B-End Designation). Now I can have list of fiber number like 13,14,15,16,21,22,23,24 in one cell.
I haven't tried the Python as I have no experience on it.
Want to know is there string function I can just take the 1st and last of the range?
So the cell with data (13,14,15,16,21,22,23,24), and string function to get 1st (13) and last one (24) to do some calculation?
Â
Thanks
If your fiber numbers are always four characters (F123) then this is a very easy solution in a StringConcatenator:
Â
Â
@Left(@Value(<fibernumber>),4)-@Right(@Value(<fibernumber>),4)
If your fiber numbers are always four characters (F123) then this is a very easy solution in a StringConcatenator:
Â
Â
@Left(@Value(<fibernumber>),4)-@Right(@Value(<fibernumber>),4)
Thanks Danullen
Now I changed each fibre number into text becomes 001, 002, 003, 004, 005 ....
Using your solution I can extract 001 and 005. Now I want to subtract the high number to low number, however it seems @sub doesnt work, is it because 001 and 005 are String? How can 1 convert 001, 005 into integer to calculate the fiber number used?
Thanks
Â
Â
Thanks Danullen
Now I changed each fibre number into text becomes 001, 002, 003, 004, 005 ....
Using your solution I can extract 001 and 005. Now I want to subtract the high number to low number, however it seems @sub doesnt work, is it because 001 and 005 are String? How can 1 convert 001, 005 into integer to calculate the fiber number used?
Thanks
Â
Â
Try with @Evaluate instead:
Â
@Evaluate(@Value(<high_fiber_number>)-@Value(<low_fiber_number>))