[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

SetRange() on multifield indexes.

Posted on 1998-06-30
4
Medium Priority
?
608 Views
Last Modified: 2010-05-18
Hello there,

I've created index for few fields. I'm willing to apple range for my table, and seems I can not do that.
For example I've two fields: Symbol and Number. I've created index for these fields. TotalIndex.
Now, I'm trying something like this:

  with Table1 do
  begin
    IndexName := 'TotalIndex';
    SetRange(['a', 1],  ['m', 10]);
    ApplyRange;
  end;

I'm expecting to see all records with Symbol's value between 'a' and 'm' and
and Number's value between 1 and 10 but nothing happens. At all.
When I create separate indexes for each co;umn and write for example:

  with table1 do
  begin
    IndexName := 'NumIndex';
    SetRangeStart;
    FieldByName('Number').AsInteger := 1;
    SetRangeEnd;
    FieldByName('Number').AsInteger := 10;
    ApplyRange;
  end;

I see just what I expected to see. But I want to use one index for all fields. Possible? How?
0
Comment
Question by:_art_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 5

Expert Comment

by:ronit051397
ID: 1356648
You didn't set the range properly. This range shows symbols between 'a' and 'm' that also have numbers between 1 and 10. If you want to see both then you should use Filter instead of Range:

 with table1 do
 begin
     Filter:='SYMBOL<='+Chr(39)+'m'+Chr(39)+' AND                 SYMBOL>='+Chr(39)+'a'+Chr(39)+' OR NUMBER<=10 AND NUMBER>=1';
     Filtered:=True;
end;  

0
 

Author Comment

by:_art_
ID: 1356649
ronit,

Exactly what I need! I wanna see  records whose symbols between 'a' and 'm' and from them those where numbers between 1 and 10. Not both cases separate..
I know filters still would be the right suggestion but at some reasons I'd prefer not to use them.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1356650
Hi _art_,

Why don't you want to use Filters?

Well, maybe this is possible :

 1. Take two tables, one master other detail.
 2. Filter the master table with a to m
 3. Filter the slave with 1 to 10

Never tried it, don't even know if it will work, but you can try it.

Regards, ZiF.
0
 
LVL 3

Accepted Solution

by:
vladika earned 200 total points
ID: 1356651
I think with SetRange it's impossible.
Why?
Let Table have such date
SYMBOL      NUMBER
----------------------------------
a                     -1
a                      1
b                     -5
b                    10
m                    -1
m                   11
z                     0

I ordered it according to index.

SetRange(['a', 1],  ['m', 10]) set TWO BOUNDARIES (and ONE range) in ordered table.
First boundary between ('a',-1) and ('a',1).
Second boundary between ('m',-1') and ('m',11)
So you can see ('b',-5), ('m',-1) etc

You want set many ranges. It's impossible with SetRange

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question