Alpha Video Training
Results 1 to 13 of 13

Thread: Return to current row after sorting an embedded browser

  1. #1
    Member
    Real Name
    marcus wolfe
    Join Date
    Jan 2009
    Posts
    24

    Default Return to current row after sorting an embedded browser

    How do I use action script to:
    1) remember the current record in an embedded browse on a form
    2) do an A -Z sort on the embedded browse
    3) return focus to the previous 'current record' after the sort routine has run.

    Using action scripts, I have been able to:
    1) set the current record as a variable (I think this works), sort the embedded browser. The sort works but the focus gets set to the first record in the embedded browse.

    How do I get A5 to remember the current row number and return to that value after the sort has run?

  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: Retrun to current row after sorting an embedded browser

    There is no such thing as an embedded browser, there is an embedded browse.

    You want to get the row number of the selected record, set the order to something other than row number, then find by row number. That doesn't make any sense in my admitted limited comprehension. It would seem you want to get the unique value of the current record which can be found in the new sort order. Then sort A-Z by that field, then find the record with the unique value obtained previously.

  3. #3
    "Certified" Alphaholic Ray in Capetown's Avatar
    Real Name
    Ray Hendler
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    2,036

    Default Re: Retrun to current row after sorting an embedded browser

    Marcus there's an action script action strangely called
    "go to record number"
    (You're getting flack tonight)
    well night here anyway
    Last edited by Ray in Capetown; 11-27-2011 at 06:21 PM.

  4. #4
    Member
    Real Name
    marcus wolfe
    Join Date
    Jan 2009
    Posts
    24

    Default Re: Retrun to current row after sorting an embedded browser

    I've tried the goto record number tool. When the routine runs I get an error saying
    'topparent.recno_goto(var_recno_target)
    Record number is past end of table'.

    I have one parent record and 12 child records. The inital variable is to 10, so it is trying

    I think the goto record tool is acting on the parent level of the form data. I need it to operate on the browse data, which shows data from a child table from the data set.
    Is there a way to adjust the code so the 'goto record number' operates only on a browse showing child table data? I think that will do it.

  5. #5
    "Certified" Alphaholic Ray in Capetown's Avatar
    Real Name
    Ray Hendler
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    2,036

    Default Re: Return to current row after sorting an embedded browser

    That is correct. I can see ActionScript cant perform the operation that you want, is fairly complex

    The browse works on rows and when you change column order the row order is altered.

    You want to obtain a RECORD number from the underlying child table and after re-organizing the table order, find the row that links to that record number and set focus to it.

    It is possible but more advisable to use query and/or find methods at browse level to suit the specific purpose.
    Otherwise you would need xbasic synchronization between table and form levels.
    Last edited by Ray in Capetown; 11-28-2011 at 05:13 PM.

  6. #6
    Member
    Real Name
    Don Lavigne
    Join Date
    Jan 2007
    Location
    New Jersey
    Posts
    223

    Default Re: Return to current row after sorting an embedded browser

    You've probably already figured this out.. but this is what I do to go to a specific record on a browse for a child table:

    while Browse_name:Some_id.value<>varSomeID 'basically GET the id of the child record before you perform the sort or whatever operation you do
    topparent:Browse_name.fetch_next() 'then navigate through the browse until the matching id comes up
    if Browse_name.mode_get()=2
    ' ui_freeze(.f.) 'optional command if you don't want to "see" the navigation through the records in the browse
    end
    end if
    end while

    Hope that helps.


    Don

  7. #7
    Member
    Real Name
    John Tary
    Join Date
    Jan 2007
    Posts
    418

    Default Re: Return to current row after sorting an embedded browser

    while Browse_name:Some_id.value<>varSomeID 'basically GET the id of the child record before you perform the sort or whatever operation you do
    topparent:Browse_name.fetch_next() 'then navigate through the browse until the matching id comes up
    if Browse_name.mode_get()=2
    ' ui_freeze(.f.) 'optional command if you don't want to "see" the navigation through the records in the browse
    end
    end if
    end while
    I have been somewhat succesful employing the above method, however when using this on a filtered browse and the item that is changed no longer meets the browse filter, then it is gone and searching through the records causes a crash, which I suppose is running into the end of the file. How can you simply employ an EOF check using the simple code above?

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

    Default Re: Return to current row after sorting an embedded browser

    What's the application John?
    Concierge?
    Ted Giles
    Example Consulting - UK
    .

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

  9. #9
    Member
    Real Name
    John Tary
    Join Date
    Jan 2007
    Posts
    418

    Default Re: Return to current row after sorting an embedded browser

    Yes, same app I have started working on after a year. I have a filtered embedded browse and a couple of fields on a form from that browse. When I change a value in the browse from a field that it is sorted on, the sort changes which usually sends the record to the bottom of the browse, and Alpha shows this as the top line of the browse and there are no other records. This looks funny so what I wanted to do is let it sort, fetch the first record and change the pointer in the browse to mactch that changed record, looks much cleaner.

    It worked fine, until...
    The table is filtered and I changed the value beyond the scope of the filter so the record was gone, it seems the while loop error'd out and crashed everything. I have seen eof() used before, but involved getting the table (this data and filter is based on a set which is problematic) and I was wondering if there was an easier way. I thought about just checking if the changed value was one of the choices out of the filter and not running the script, but it has been giving me problems and I thought there might be an easier way.

  10. #10
    Member
    Real Name
    Don Lavigne
    Join Date
    Jan 2007
    Location
    New Jersey
    Posts
    223

    Default Re: Return to current row after sorting an embedded browser

    Quote Originally Posted by johngtatp View Post
    I have been somewhat succesful employing the above method, however when using this on a filtered browse and the item that is changed no longer meets the browse filter, then it is gone and searching through the records causes a crash, which I suppose is running into the end of the file. How can you simply employ an EOF check using the simple code above?
    use before while statement...
    topparent:Browse_Name.fetch_first()

  11. #11
    Member
    Real Name
    John Tary
    Join Date
    Jan 2007
    Posts
    418

    Default Re: Return to current row after sorting an embedded browser

    use before while statement...
    topparent:Browse_Name.fetch_first()
    I do this already. What is happening is the record disappears from the filtered browse so it is no longer visible. As the script goes through the while function it goes to the first record then steps through each record in the browse but then gets to the end of the file as there are no more records because the one it was on has been filtered away. This causes a crash. I currently "fixed" this by not allowing a change that would allow the record to get through the filter.

  12. #12
    Member
    Real Name
    Don Lavigne
    Join Date
    Jan 2007
    Location
    New Jersey
    Posts
    223

    Default Re: Return to current row after sorting an embedded browser

    Quote Originally Posted by johngtatp View Post
    I do this already. What is happening is the record disappears from the filtered browse so it is no longer visible. As the script goes through the while function it goes to the first record then steps through each record in the browse but then gets to the end of the file as there are no more records because the one it was on has been filtered away. This causes a crash. I currently "fixed" this by not allowing a change that would allow the record to get through the filter.
    I'm not sure what your doing between the while statement, but have you tried:

    while Browse_name:Some_id.value<>varSomeID .and. Browse_name:Some_id.value>null_value()

    if that doesn't work you'll at least have to provide the code between the while statement for me to help further.


    Don

  13. #13
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,077

    Default Re: Return to current row after sorting an embedded browser

    Marcus,

    After Sorted or changed something, then the current browse's focus are changed. See this. may help on your problem.

    http://msgboard.alphasoftware.com/al...le-fetch_first

Similar Threads

  1. How do I save and return to current record
    By thebowie in forum Application Server Version 10 - Web/Browser Applications
    Replies: 2
    Last Post: 05-25-2010, 03:36 PM
  2. Browser return more data than asked
    By MikeData in forum Alpha Five Version 9 - Desktop Applications
    Replies: 11
    Last Post: 02-10-2009, 08:26 PM
  3. Tree View sorting by the Current Set.
    By Jonathan Short in forum Alpha Five Version 6
    Replies: 1
    Last Post: 09-13-2004, 06:02 AM
  4. sorting inside a embedded browser
    By Richard Nagle in forum Alpha Five Version 4
    Replies: 2
    Last Post: 09-08-2001, 04:31 PM
  5. Return to top of embedded browse
    By CALocklin in forum Alpha Five Version 4
    Replies: 12
    Last Post: 05-29-2001, 03:06 PM

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
  •