Alpha Video Training
Results 1 to 7 of 7

Thread: How do i create indexes??

  1. #1
    Member
    Real Name
    David Boomer
    Join Date
    Apr 2000
    Location
    Brampton Ontario, Canada
    Posts
    662

    Default How do i create indexes??

    I am running a Join Operation... it creates a table named JoinCPODetail.dbf

    The problem I'm having is that the two indexes that I need are deleted when the table is updated...
    so... I wrote the following script:

    'When the Joincpodetail table is updtaed / created the indexes are destroyed... this script saves the index definitions... runs the join... then recreaes the indexes

    'Consultnum All Ascending, DateToProcess All Decending

    'dim IndexDefs As C
    dim t As P

    'IndexDefs = Get_Index_Definitions("JoincpoDetail")

    'Run a saved 'Join' operation: 'JoinCPODetail'.
    query.filter = ""
    query.order = ""

    DIM operation_name as c
    operation_name = "JoinCPODetail"
    If operation_name <> "" then
    join.run(operation_name,query.filter , "")
    End if

    ui_msg_box("CONSULTNUM AND DtoP INDEXES WILL BE RECREATED","CONSULTNUM AND DtoP INDEXES WILL BE RECREATED",UI_ATTENTION_SYMBOL+UI_OK)

    'Result = CREATE_INDEXES("JoinCPODetail", "IndexDefs", .t. )
    t = Table.open("JoinCPODetail",FILE_RW_EXCLUSIVE)
    t.index_create_begin("Consultnum","Consultnum","","")
    t.index_create_end()
    t.index_create_begin("DtoP","Datetoprocess","","")
    t.index_create_end()
    t.close()

    ui_msg_box("Indexes Hve Been Re-Created", "Indexes Hve Been Re-Created",UI_INFORMATION_SYMBOL+UI_OK)

    The script creates the first index 'Consultants'... but not the second 'DtoP'
    Also I want the second index to be Descending All

    How can I do this?

    Thanks D

  2. #2
    "Certified" Alphaholic
    Real Name
    Finian Lennon
    Join Date
    Apr 2000
    Location
    Atlanta, GA
    Posts
    1,803

    Default Re: How do i create indexes??

    David, this is from memory, but have you set the option to preserve the data dictionary in the result table? I seem to recall that when this is set, your various definitions persist.
    Finian

  3. #3
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,318

    Default Re: How do i create indexes??

    Try closing the table after the first index is created, reopen it and do the next one.
    If you want to use your code that is.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  4. #4
    Member
    Real Name
    David Boomer
    Join Date
    Apr 2000
    Location
    Brampton Ontario, Canada
    Posts
    662

    Default Re: How do i create indexes??

    Thanks Finian... the Dictionary is preserved ie forms etc... but the indexes are not :-(

  5. #5
    Member
    Real Name
    David Boomer
    Join Date
    Apr 2000
    Location
    Brampton Ontario, Canada
    Posts
    662

    Default Re: How do i create indexes??

    Thanks Ted... I tried closing the table... now only the second index is created, not the first... also I can't get the Descending All spec to work... so I am using "" because <?D'A> and "?D'A" don't work

  6. #6
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,318

    Default Re: How do i create indexes??

    Ok.
    Try it as 2 separate processes then from the Interactive pane.
    Do one, see if it sticks, then do the other.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  7. #7
    Member
    Real Name
    David Boomer
    Join Date
    Apr 2000
    Location
    Brampton Ontario, Canada
    Posts
    662

    Default Re: How do i create indexes??

    Solved !!!… well almost... I still can't get the index to be in Descending order... I've tried "D", "<D>" and <D> it is always Ascending

    Here is the code that worked:
    query.filter = ""
    query.order = ""

    DIM operation_name as c
    operation_name = "JoinCPODetail"
    If operation_name <> "" then
    join.run(operation_name,query.filter , "",.t.)
    End if

    ui_msg_box("CONSULTNUM AND DtoP INDEXES WILL BE RECREATED","CONSULTNUM AND DtoP INDEXES WILL BE RECREATED",UI_ATTENTION_SYMBOL+UI_OK)

    'Result = CREATE_INDEXES("JoinCPODetail", "IndexDefs", .t. )
    t = Table.open("JoinCPODetail",FILE_RW_EXCLUSIVE)
    t.index_create_begin("Consultnum","Consultnum","","")
    t.index_add("DtoP","Datetoprocess","","")
    t.index_create_end()
    t.close()

    ui_msg_box("Indexes Hve Been Re-Created", "Indexes Hve Been Re-Created",UI_INFORMATION_SYMBOL+UI_OK)

    t.index_create_begin() can only be used once... additional tags must be specified using t.index_add()

Similar Threads

  1. Indexes
    By ColinJD in forum Alpha Five Version 9 - Desktop Applications
    Replies: 9
    Last Post: 09-03-2009, 08:44 PM
  2. Cannot create indexes
    By Sharon Herndon in forum Alpha Five Version 6
    Replies: 3
    Last Post: 07-11-2005, 11:31 PM
  3. Create NDX indexes in Alpha Five?
    By brett s in forum Alpha Five Version 5
    Replies: 5
    Last Post: 02-23-2005, 01:28 AM
  4. Indexes
    By L. Lautenbach in forum Alpha Five Version 5
    Replies: 1
    Last Post: 01-07-2003, 07:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •