Between

10 posts / 0 new
Last post
Ahmed
Offline
Joined: 09/20/2017 - 05:45
Between

Hi,
I would like to find an equation that allow me to find a number if it is in a range of numbering 
I attachd a file .xls as un example,
Thank you.

Files: 
Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Admed,

Thanks for giving an example file.  Try this function with a character field, it will return Yes if the number is between the range and No if it isn't.

@if(@Between(NUMBERS, FROM, TO) = 1, "Yes", "No")

Ahmed
Offline
Joined: 09/20/2017 - 05:45

Hi Brian,
Thank you very much. 
So this equation work for the same line; but how we can change it to look up for all the line for example if = "NO" go to next value ....
 

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Ahmed,

You can use the @GetNextValue() function but I am not 100% sure what you are asking.  So what happens if it is NO for the next one, are you just trying to find a match?

Ahmed
Offline
Joined: 09/20/2017 - 05:45

Yes Brian, i'm just looking to find a match but at one condition is to look up till the final line.
Thank you.

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Ahmed,

Scott has created a script that should help you out, it is in post #5 from this thread (http://ideascripting.com/forum/joining-tables-when-key-between-two-value...)

You will have to break out your file into two files, one with the upper and lower limits and another with just the numbers.  For the upper and lower limit file if you don't already have a field that indicates what the range is you can add a recno field to the file so it know how it relates.

Let me know how it goes and if it works for you.

Thanks

Brian

Ahmed
Offline
Joined: 09/20/2017 - 05:45

Hi Brian,
I followed your recommendations and it worked perfectly 
Thank you very much for your help.

Ahmed
Offline
Joined: 09/20/2017 - 05:45

Hi Brian
when I run the script; It takes a lot of time, because I tested it on 150 000 lines and it take it 16 hours ! 
How is it possible to make it faster ?
Thank you.

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

There might be a few ways to make it more efficient but I don't think there will be huge savings.  It is the nature of the beast where this is comparing all the records against multiple criteria so it is going to take a long time.  Also this is a script so it is much slower then if this was a built in IDEA function.  

Ahmed
Offline
Joined: 09/20/2017 - 05:45

Okay,
Thank you.