Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with RANGE

0 Likes
728

Good morning, people of the forum ...

I have the following question ...

Is there any sentence that tells me if a range is contained within another range of the same type??

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
685

Use 'IN' keyword to validate.

Eg: Range1[] in Range2[]

5 REPLIES 5
Read only

Former Member
0 Likes
685

well, if the ranges are same you can always check

if range1[] = range2[]

.. else you will have to loop over one range and read the values from the other range to compare.

Read only

Former Member
0 Likes
686

Use 'IN' keyword to validate.

Eg: Range1[] in Range2[]

Read only

0 Likes
685

I think the second answer is more appropriate ...

But I do not think I expressed myself very well ...

What I really want is to know if there is intersection between two ranges of the same type (not necessarily equal).

For example, for two ranges of type DATE, if the first range is from 01/05/2010 to 31/05/2010 and the second range is from 05/15/2010 until 15/06/2010 (in format dd/MM/yyyy), the result should be TRUE, but if the ranges do not intersect, the result should be FALSE.

Is this possible??

Read only

0 Likes
685

Well you can try this logic

loop at r1.

while r1-low < = r1-high.

if r1-low in r2.

exists.

exit.

endif.

r1-low = r1-low + 1.

endif.

endwhile.

Read only

0 Likes
685

You mean... evaluate each value of r1 in r2???

Yeah... I can do that, but I thought there was a simpler and more abreviated method...

Well, I think I'll take your suggest..

Thanks