Here's what I'm trying to accomplish inside of my tag creator screen.
I have a table and I would like to enter 2 different values in the same row, col ie. (1,8).
Do we have a way of pulling out the numbers 1 thru 8 ? If only 1 and 8 are presented to the dataset?
Also note, i would like to retain the 8 so that in the row below if they put 1 thru 5, we would know to start at 9 thru 13.
If not, does anyone know a way to do this outside of a dataset using numeric text field ?
Any help would be greatly appreciated !
These numbers will run through my tag creator and produce tags from the range(1,8) using the numbers at the end of the tag ex. TT[1], TT[2] all the way up to 8.
What does datasets have to do with this ?
Is that just the one in the table's data property ?
Is there anything else in your table ?
is the number of numeric entry fields dynamic ?
Is the base tag path always the same ?
Do you want the numbers to start from 1 or from the first value entered ?
This raises so many questions !
something like this maybe ?
ranges = zip(ds.getColumnAsList(index_of_start_column), ds.getColumnAsList(index_of_end_column))
r = reduce(lambda x, (s, e): x + (e - s), ranges, 0)
paths = [base_path.format(n) for n in xrange(1, r)]
edit:
I think you should give us an example, to make things clear.
Let's say user inputs something like this:
1, 8
3, 6
2, 7
What's the list of numbers you expect from that ?
What happens if someone enter let's say 5, 2 ?
Here's a picture of what I have on the screen.
My Op tagpath is as follows opIndex = 'Op[' + opsData.data[1][o] + ']' which spits out Op[1] tagpath.
I would like to do the same for my TT[1] thru TT[8] with what's entered in the TT section. My Op[1] could potentially have 8 TTs in one Op. I'm not sure what way is easiest to accomplish this.
My apologies , all I want to take from the table you have would be this:
2,8 = TT[1], TT[2],TT[3],TT[4],TT[5],TT[6],TT[7]
3,4 = TT[8], TT[9]
2,5 = TT[10], TT[11], TT[12] , TT[13]
TT[x ] is my tagpath which is also an array.
That is: What you're saying likely makes perfect sense in your head, but we're all not familiar enough with your environment/requirements/previous attempts/all other context to piece it together.
So to avoid the XY problem, try to, as clearly as possible, describe what it is you're trying to do with all the context you can. This forum's full of volunteers who are more than willing to help, but no one likes working with unclear requirements.
I'm gonna assume the "x,y" in the TT column actually a string. This should build a list of paths that look like ["TT[1]", ..., "TT[n]"]
ranges = ((int(n) for n in r.split(',')) for r in ds.getColumnAsList(2))
r = reduce(lambda x, (s, e): x + (e+1 - s), ranges, 1)
paths = ["TT[{}]".format(n) for n in xrange(1, r)]
I think he needs to generate tags paths. The pattern then is irrelevant, as it could be anything whoever is in charge has decided. Start with 0, start with 1, start with 3, skip even numbers... doesn't really matter at this point.