Alpha Video Training
Results 1 to 2 of 2

Thread: can tbl.summarize() be filtered?

  1. #1
    Member mariusm's Avatar
    Real Name
    Marius M.
    Join Date
    Sep 2006
    Location
    Plymouth, UK
    Posts
    199

    Default can tbl.summarize() be filtered?

    Relating to my earlier post...
    I'm trying to use tbl.summarize() to get a table that has summary of some fields; it works well when applied to the whole table, but I am trying to get a summary of a filtered table. Here is the code I'm using:
    summarize_db_name = filename_decode("custSummary.DBF")

    dim tbl as p

    tbl = table.open("shipping")
    filter = "PU_week =var->varWeek"
    query.filter = replace_parameters(filter,local_variables())
    query.order = ""
    qry = tbl.query_create()


    ON ERROR GOTO ERROR3011200714052484

    sum.db = summarize_db_name
    sum.db_dd_delete = .F.
    sum.result_overwrite = .F.
    sum.order = "CUSTOMER"
    sum.filter = ""
    sum.options = "I"
    sum.fields = 8
    sum.field1 = "Customer"
    sum.code1 = 0
    sum.field2 = "Customer"
    sum.code2 = 2
    sum.field3 = "Truck_Cost"
    sum.code3 = 1
    sum.field4 = "SELL_PRICE"
    sum.code4 = 1
    sum.field5 = "MARGIN"
    sum.code5 = 1
    sum.field6 = "MARGIN"
    sum.code6 = 5
    sum.field7 = "TOTAL_PCS"
    sum.code7 = 1
    sum.field8 = "TOTAL_WEIGHT"
    sum.code8 = 1

    tbl.summarize()


    GOTO CONTINUE3011200714052484
    ERROR3011200714052484:
    ON ERROR GOTO 0
    ui_msg_box("Error","Error running Summarize Operation"+crlf()+error_text_get())
    END
    CONTINUE3011200714052484:
    tbl.close()
    'Add the table just created by the Summarize operation to the Database..
    file_add_to_db(summarize_db_name)
    problem is, the tbl.summarize still gives me a summary of the whole table, not of the filtered data. How do I filter the data I send to this function?
    It is easier to get older than wiser

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: can tbl.summarize() be filtered?

    Put your query filter expression in

    sum.filter = ""

    (or you could just say sum.filter = query.filter

    but there is no reason to run the query.

    They are independent.

Similar Threads

  1. <TBL>.SUMMARIZE() question
    By Ralf in forum Alpha Five Version 8
    Replies: 6
    Last Post: 09-02-2007, 02:53 PM
  2. <tbl>Change_Begin and <tbl>.post()
    By Graham Wickens in forum Alpha Five Version 7
    Replies: 5
    Last Post: 08-22-2007, 08:52 AM
  3. Summarize ??
    By BRIAN GRAY in forum Alpha Five Version 5
    Replies: 1
    Last Post: 07-29-2004, 06:38 AM
  4. Summarize Problem
    By samkerr in forum Upgrading to Alpha Five from Alpha Four
    Replies: 1
    Last Post: 02-11-2004, 09:56 AM
  5. Cpy Flds in currnt tbl & post to other tbl
    By Danny Marx in forum Alpha Five Version 4
    Replies: 8
    Last Post: 08-24-2000, 10:08 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
  •