Alpha Video Training
Results 1 to 5 of 5

Thread: detach filter in SET.EXTERNAL_RECORD_CONTENT_GET()

  1. #1
    Member
    Real Name
    Trevor Sayers
    Join Date
    Jan 2004
    Posts
    118

    Default detach filter in SET.EXTERNAL_RECORD_CONTENT_GET()

    Hi folks,

    To ensure a filter is current, you would normally use "TBL".QUERY_DETACH() or "TBL".QUERY_DETACH_ALL(). However, when your data is generated by a filter in set.external_record_content_get(), how do you reference the query to detach it?

    What I have is similar to the Anchor Buttons - Advanced Example except I am using a set. I added a filter and a right-click menu option which (correctly) changes the current rec such that it should now get filtered out but as the filter hasn't changed, A5 uses the old out-of-date query and the rec still shows in the re-generated list. For the manual example, the equivalent would be having changed...
    auto_list_cl_id = table.external_record_content_get("clients","alltrim(Customer_Id)+\"|\"+alltrim(Firstname)+\"|\"+alltrim(Lastname)",sort_by,"")
    ...to..
    myfilter = "left(alltrim(Lastname,2)=\"Mc\""
    auto_list_cl_id = table.external_record_content_get("clients","alltrim(Customer_Id)+\"|\"+alltrim(Firstname)+\"|\"+alltrim(Lastname)",sort_by,myfilter)
    ...running script and and then have the right-click menu option change Joan McAndrews' name to, say, Joan Doe.

    Thanks in advance.

    Regards,
    Trevor

  2. #2
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default RE: detach filter in SET.EXTERNAL_RECORD_CONTENT_G

    Trevor:
    I think there is more to it than meets the eye:
    you are logically assuming that it's a "query" and wondering how to delete it, but is it really?? just because it functions like a query, that doesn't mean it's a query. By that I mean: does alpha save it as a query, if it even saves it at all?
    One way to find out, is query_enum()

    If it shows up (I doubt that it will) then you might be able to detach it.

    I don't think it will show up, further I think the behavior you notice has to do with the child table refreshing issue (a rather daunting issue which alpha is overhauling in V7). To confirm that this is actually the issue, try to close then re-open the table and re-run the script and see if the filter will update probably. My guess, it will.
    Gabe

  3. #3
    Member
    Real Name
    Trevor Sayers
    Join Date
    Jan 2004
    Posts
    118

    Default RE: detach filter in SET.EXTERNAL_RECORD_CONTENT_G

    Gabe,

    except as may be done by the SET.EXTERNAL_RECORD_CONTENT_GET() command itself, the set isn't opened such that it can be closed. i.e. there is no pointer to it: no command anywhere of...
    s=set.open(datasourceset)

    With no pointer, I can't go (s.xxxx)e.g.
    s.query_detach(myfilter)
    ...or use any of the other "s.xxxx" query commands. Also, as what I'm doing is in XDialog, I can't reference any forms,browses or objects and I don't have a menu to go Query " Select Index/Query to display the Query dialog box either.

    Finally, please note that if I change the filter, run the function that calls the data - get_data(lv) - and then revert the filter to what it was, the correct records ARE returned, so it seems there may be only one query slot rather than four as normal.

    Thanks,
    Trevor

  4. #4
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default RE: detach filter in SET.EXTERNAL_RECORD_CONTENT_G

    Trevor:
    I realize you did not open the table, but the behavior seems identiacal to what you would see in child table updates and further, you do have a pointer to the table:
    ""table.external_record_content_get("clients"""

    One would assume that this script "opens" the table. Maybe, maybe not. My guess is, it does.

    ""I don't have a menu to go Query " Select Index/Query to display the Query dialog box either. ""
    You do not have to have any, in the interactive window type:
    ?A5.QUERY_ENUM()
    This will give you a list of all the queries in your DB. As I indicated, I doubt seriously that you will see that "query" in the list.

    In the heart of the problem too, is the fact that alpha does not save "filters", it saves queries. You are not dealing with a query here, but rather with a filter. A filter, is an ingerdient of a query but it does not create tables, queries, like indeces, do. You can not update something that is not there, the only alternative is to re-run it.

    Your experiemnt with changing the filter makes me believe further that my theory is correct. Changing the filter would have the same effect of opening and closing the table.

    Other suggestions:
    1-Try:
    t=table.open("clients")
    t.refresh()
    t.close()

    Or just simply open and close the table as two additional lines in your script. That should update the filter.

    2-Try:
    dim tbl as P
    dim qry as P
    tbl = table.open("client")
    query.filter = "put your filter here"
    query.options = "D"
    qry = tbl.query_create()
    qry.refresh()
    Gabe

  5. #5
    "Certified" Alphaholic
    Real Name
    William Hanigsberg
    Join Date
    Apr 2000
    Location
    Toronto, ON
    Posts
    4,018

    Default RE: detach filter in SET.EXTERNAL_RECORD_CONTENT_G

    It is not (as it would be if you were working in a form) a question of dropping the query. Rather, you need to regenerate the list.

    Bill

Similar Threads

  1. Can't detach query
    By David Montgomery in forum Alpha Five Version 6
    Replies: 0
    Last Post: 03-31-2005, 09:23 PM
  2. table.external_record_content_get
    By Blake in forum Alpha Five Version 5
    Replies: 5
    Last Post: 08-18-2003, 06:15 PM
  3. external_record_content_get()
    By Stan Mathews in forum Alpha Five Version 5
    Replies: 2
    Last Post: 05-29-2003, 06:57 AM
  4. table.external_record_content_get - filter?
    By Daniel Weiss in forum Alpha Five Version 5
    Replies: 3
    Last Post: 05-04-2003, 01:39 PM
  5. query detach
    By dparkins in forum Alpha Five Version 5
    Replies: 9
    Last Post: 12-04-2002, 05:04 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
  •