Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

new index on a table 1

Status
Not open for further replies.

christoffel

Programmer
Jun 29, 2004
15
0
0
NL
I have a table created by a query. What is an easy way to set an index on the table. The table must be showed in a tableframe in a form.
thanks
 
Tony
This is what i made of it: setrange doesnot work.
open method of the tableframe:

tc.attach(selectfactuur) ; tc=tcursor, selectfactuur=tableframe
if not tc.lock("Full")
then msgstop("stop","kan niet locken")
return
endif

index tc
MAINTAINED
ON "bedrijf_naam"
TO "bedrijfnaam"
endIndex

delayScreenUpdates(Yes)
doDefault
tc.switchIndex("bedrijfnaam")
tc.setRange(hbedrijfnaam , hbedrijfnaam )

self.nRows = 10

delayScreenUpdates(No)
 
You asked about indexing. Not about limiting a view of a tableframe using an index or setrange.

Help for tableview states:
==================================
· the TableView object as a whole (e.g., background color, grid style, number of records, and the value of the active record)
· the field-level data in the table (e.g., font, color, and display format(TVData))
· the TableView heading (e.g., font, color, and alignment(TVHeading))
==================================

You can't use a tableview var to set an index, I don't believe, let alone a range.

Likely you'd need to use sendkeys() to FILTER the table.

Tony McGuire
 
Oooops!

I went to 'tableview', rather than tableframe. Sorry.

I sure wish there was a way to edit or delete messages.

Do you have the form open prior to executing the query?

It'd sure be easier if not.

Perhaps a bit more of a description of the steps this procedure is going thru (when query is run, when form is opened, etc) would help....???


Tony McGuire
 
Also, making changes to (switchindex,setrange) a tcursor does NOT reflect in a tableframe.

Once you've got the tc the way you want it, you need to

uiname.resync(tc)

But trying to modify a table that is displayed on a form may not work; REALLY depends on WHEN you make those changes and the state of the tableframe.

Can you do this stuff PRIOR to opening the form with the tableframe on it?

Tony McGuire
 
thanks,
it's now almost newyear. tomorrow i study your replies.
thanks
chris
from holland
 
Tony,
Happy newyear,
as you can see i set the indes before i start the form. But is doesnot work because i don't see that the indexed is set on the table (structure information of the table). What goes wrong?
Chris

SCRIPT:
var
frm form
tc tcursor
endvar

if not executeqbefile("selectfactuur.qbe") then
msgstop("Stop","Kan query SELECTEERFACTUUR niet starten")
endif

if not tc.open("selectfactuur.db")
then view("geen tabel selectfactur te vinden")
endif

index tc
PRIMARY
ON "zendingnr"
TO "zendingnr"
endIndex

index tc
MAINTAINED
ON "bedrijf_naam"
TO "bedrijfnaam"
endIndex

tc.close()

beep()
frm.open("factureren.fdl")
frm.wait()

 
index tc
PRIMARY
ON "zendingnr"
TO "zendingnr"
endIndex



First, use a table variable to index.

tb.attach("selectfactuur.db:)
index tb
primary
on "zendingnr"
; note, no TO for primary
endindex


index tb
MAINTAINED
ON "bedrijf_naam"
TO "bedrijf_naam" ; name the same as the field, unless you use more than one field
endIndex


Tony McGuire
 
Thanks,
It's working, only without a _, therefor i used a space. Always the same mistake.
Chris

tb.attach("selectfactuur.db")

index tb
PRIMARY
ON "zendingnr"
endIndex

index tb
MAINTAINED
ON "naam bedrijf"
TO "naam bedrijf"
endIndex
 
Don't forget to tb.unattach().

And, whenever possible, do NOT use '_' or space in field/index name. Use a-z and 0-9 only.

Makes it a bit harder to manage your stuff in forms/reports with spaces in field names, since Paradox adds '_' instead of spaces in field names for forms/reports; and then you have to remember to reference them that way.



Tony McGuire
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top