I have a col A which has values from 1-5. Can we get the list of all values of col A from 1-5. If so, could you please help me with the logic.
Thanks!
I have a col A which has values from 1-5. Can we get the list of all values of col A from 1-5. If so, could you please help me with the logic.
Thanks!
I can see two numbers concatenated with a hyphen for each cell in the col A (EVENTIDRAN field).
"737055 - 737060", "737061 - 737066", ...
Do you need to get all the individual values from them?"737055", "737060", "737061", "737066", ...
Hi @fmeuser_gc - I feel that there will be more than one solution,.. but here is an example workspace template that you can use or build upon. This workspace will add attributes _valx for each integer in the range defined by EVENTIDRAN.
Edit: This workspace was built with FME 2017.1.1 Build 17650 – if incompatible with your FME, the meat and bones of this workspace is included in the image below!
example-extractvaluefromrange.fmwt
Note: It relies on the values of EVENTIDRAN to always be a range that covers six integers, inclusive.
Hi @fmeuser_gc
one more possible approach could be to:
This will allow you to process ranges that include different number of values.
I can see two numbers concatenated with a hyphen for each cell in the col A (EVENTIDRAN field).
"737055 - 737060", "737061 - 737066", ...
Do you need to get all the individual values from them?"737055", "737060", "737061", "737066", ...
Hi @fmeuser_gc - I feel that there will be more than one solution,.. but here is an example workspace template that you can use or build upon. This workspace will add attributes _valx for each integer in the range defined by EVENTIDRAN.
Edit: This workspace was built with FME 2017.1.1 Build 17650 – if incompatible with your FME, the meat and bones of this workspace is included in the image below!
example-extractvaluefromrange.fmwt
Note: It relies on the values of EVENTIDRAN to always be a range that covers six integers, inclusive.
example-extractvaluefromrange-20151.fmwt
Hi @fmeuser_gc - I feel that there will be more than one solution,.. but here is an example workspace template that you can use or build upon. This workspace will add attributes _valx for each integer in the range defined by EVENTIDRAN.
Edit: This workspace was built with FME 2017.1.1 Build 17650 – if incompatible with your FME, the meat and bones of this workspace is included in the image below!
example-extractvaluefromrange.fmwt
Note: It relies on the values of EVENTIDRAN to always be a range that covers six integers, inclusive.
@Evaluate(@Value(_range{0})+1)
Hi @fmeuser_gc - I feel that there will be more than one solution,.. but here is an example workspace template that you can use or build upon. This workspace will add attributes _valx for each integer in the range defined by EVENTIDRAN.
Edit: This workspace was built with FME 2017.1.1 Build 17650 – if incompatible with your FME, the meat and bones of this workspace is included in the image below!
example-extractvaluefromrange.fmwt
Note: It relies on the values of EVENTIDRAN to always be a range that covers six integers, inclusive.
But the tricky part is EVENTRANGE is not always a specific set of range. It can be any numbered range and has to be dynamic. Would it be possible to make it dynamic?
For ex: Range 5-10 and if we define for x, x+1, x+2, x+3. In this case we will end up missing values of 9, 10.
But the tricky part is EVENTRANGE is not always a specific set of range. It can be any numbered range and has to be dynamic. Would it be possible to make it dynamic?
For ex: Range 5-10 and if we define for x, x+1, x+2, x+3. In this case we will end up missing values of 9, 10.
I suggest that you give it a try – the FME Community will be here to help! You may find it useful to create separate Q&A; postings based on what part of the workflow you need help with.
I suggest that you give it a try – the FME Community will be here to help! You may find it useful to create separate Q&A; postings based on what part of the workflow you need help with.
If the number of values within a range could be different for each row, the method suggested by @LenaAtSafe can be applied.
Alternatively, the AttributeSplitter + PythonCaller with a small script could also be a solution. For example, assuming that the hyphen-separated range values has been split into _list{0} and _list{1} with the AttributeSplitter beforehand, a PythonCaller with this script stores every value within the range into a list attribute called "_value{}".
# PythonCaller Script Example
def extractRangeValues(feature):
s = int(feature.getAttribute('_list{0}'))
t = int(feature.getAttribute('_list{1}'))
for i, v in enumerate(range(s, t+1)):
feature.setAttribute('_value{%d}' % i, v)<br>
Hi @fmeuser_gc
one more possible approach could be to:
This will allow you to process ranges that include different number of values.
Hi @fmeuser_gc
one more possible approach could be to:
This will allow you to process ranges that include different number of values.
For ex: To read from 10 to 5 or 19 to 12
Currently I'm reading from dynamic lower to higher range. Ex: 5 to 10, 12 to 19.
I can see two numbers concatenated with a hyphen for each cell in the col A (EVENTIDRAN field).
"737055 - 737060", "737061 - 737066", ...
Do you need to get all the individual values from them?"737055", "737060", "737061", "737066", ...
For ex; 737060 - 737055 should be exploded as 737055, 737056, 737057, 737058, 737059, 737060
For ex; 737060 - 737055 should be exploded as 737055, 737056, 737057, 737058, 737059, 737060
@takashi, @LenaAtSafe - I also encountered values with multiple ranges within single field (For ex: 1-5, 6-10 in single field) which causing it to fail.
It was working earlier for only single range values say 1-5 in a single field.
Apologize many questions on this scenario.
@takashi, @LenaAtSafe - I also encountered values with multiple ranges within single field (For ex: 1-5, 6-10 in single field) which causing it to fail.
It was working earlier for only single range values say 1-5 in a single field.
Apologize many questions on this scenario.