Alpha Video Training
Results 1 to 14 of 14

Thread: embedded browse & .refresh()

  1. #1
    Member
    Real Name
    Doug Chanley
    Join Date
    Apr 2000
    Posts
    563

    Default embedded browse & .refresh()

    I am using xbasic to write from one child to another in a set.
    When the script has run to include a .refresh()for the browse that
    was written to, I still only see 1 record.

    If I close the form & re-open it all of the records in the browse are there.
    I have a feeling that this has been an issue with others.....how about some
    feedback from someone who has worked through this?

    Thanks

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

    Default RE: embedded browse & .refresh()

    Hi Doug,

    There has been a ton of discussion of this, but I do not remember a simple resolution. You had best search the board. Meanwhile, what about resynch rather than refresh for the browse? But there is probably more to the matter than this.

    All the best,
    Bill

  3. #3
    "Certified" Alphaholic
    Real Name
    JohnZaleski
    Join Date
    Oct 2000
    Posts
    1,736

    Default RE: embedded browse & .refresh()

    Doug,
    I might have missed the point here, but this code is on a button in a form to add a record to an embedded browse ( child one to many). I'm not taking from one child and adding to another, but the child records do appear.

    This.disable()
    T = table.get("lines")
    T.enter_begin()
    T.order = order.value
    T.line = RIGHT("000" + LTRIM(STR(VAL(LOOKUPC("L",ORDER.VALUE , "LINE", "LINES", "Order_no"))+1)),3)
    T.item = "TESTING"
    T.enter_end(.t.)

    :OrderEntryChild:LINEITEMS.activate()
    :OrderEntryChild:LINEITEMS.FETCH_FIRST()
    This.enable()

  4. #4
    Member
    Real Name
    Doug Chanley
    Join Date
    Apr 2000
    Posts
    563

    Default RE: embedded browse & .refresh()

    Hey Bill....

    I did search the board a bit I even looked in the "archive". The only
    thing I came up with was a similar problem but with dialog forms. The
    solution is a bit awkward. In the script used to write the data to the
    child table, I have to include lines that close the form & use script_play()
    to call a script to re-open it? Otherwise I get an error if I try to use
    the button (script) to write the next parent record.

    This method works, but it sure seems like I'm having to trick the software
    into doing something that it should be able to handle on it's own. The other
    thing (which may be more likely)is that there is a better method for doing
    what I need to do. I just haven't been able to discover it, not that I'm
    complaning but Alpha5 has a long list of functions & methods in it's arsenal.
    Choosing the right one can make all the difference!

    Basically what I am doing is taking data from the "source browse" child table,
    doing some numeric calculations on some of the fields & writing it to the "target
    browse" child table of the set for the current parent record. Both tables are
    linked to the set one to many in the same way.

    If anyone can suggest a better method that will eliminate the need to close &
    re-open the form in order to see all of the records written to the target browse
    or even some infor on why this is even necessary...... Please share it!


    Bill, thanks for your response! It is good to get the chance to say Hi!

    ~doug


  5. #5
    Member
    Real Name
    Doug Chanley
    Join Date
    Apr 2000
    Posts
    563

    Default RE: embedded browse & .refresh()

    John,

    Thanks for your response! I am not real sure why the target browse dosen't
    display all the data when the script finishes. It may be because I am writing
    from one table to another that are linked to the parent in the same way. I do
    think that closing & re-opening the form is something that shouldn't have to be
    done in order to display the new data.

    The bottom line is..... doing what I am doing is making the application more
    relational & adding to its depth. I will take the "hit" on the form thing if
    I have to but I would like to know why?

  6. #6
    "Certified" Alphaholic
    Real Name
    JohnZaleski
    Join Date
    Oct 2000
    Posts
    1,736

    Default RE: embedded browse & .refresh()

    Doug,

    Are you using a concactenation of fields and/or functions to link the two one to many's to the parent, a filter with formula calculations or both. Reason for asking is that on my test tables I had no problem getting data from "one to many child browse one" and ADDING and DISPLAYING a record in "one to many child browse two". I had the same single field link between the parent and both one to many child tables with no filters. I only grabbed one field from the source browse, that should not matter, and the script worked as a button on the form and as a doubleclick event on the source browse. What you are doing really seems like it ought to work.

    Also, did you try parentform.fetch_prev()followed by parentform.fetch_next() as an alternative workaround to closing and opening the form? If that doesn't work as a part of your new record script, does it work as a button on the form itself after the record is added?

    John

  7. #7
    Member
    Real Name
    Doug Chanley
    Join Date
    Apr 2000
    Posts
    563

    Default RE: embedded browse & .refresh()

    Code:
    John,
    
    Thanks for you input, the set linking is very basic, just a single field 
    for all of the links in the set. The 2 browses in question are named "spool"
    and "pup", below is an image of the set structure.  
    
    
    
    The "spool" table(Pup1 TAB) will have many records linked to 1 "ISO". 
    In the field spool it is likly to have multiple records with
    the same pup number. (look at pup #6) in the image below .
    
    
    
    Below is an image of the "PUP" browse (Pup lengths TAB), the first field 
    is the link to the set, same as the "Pup1 TAB" browse (although the link is 
    not shown in that browse). Anyway, I am fetching through the browse above &
    writing to the browse below. I write the "Dimension" field as is, the "length"
    field is added together with all pups that have the same pup # & written to 
    the browse below in the "Fittings" field.  Then I subtract the "Fittings field
    from the "Dimension" field & write the difference to the browse below in the 
    "Pup_Length" field.  There may be a better way of doing this, mayybe in the
    field rules but I would have to be able to group all of the pups with the same
    pup # before I calculate the total for that field. 
    
    
    
    When I was developing the script, I would (in the script) zap the target table
    before I wrote any data. That may have been where the problem lays....The data
    was being written correctly, but only 1 record would show in the target browse
    when the script finished.  I went over the script & even wrote it with different
    syntax ..... I spent an embarrassing amount of time with the script....Everything
    looked OK but still only 1 record showed up in the browse when the script ran.
    Then I closed the form & check the table from the control panel....& the expected records were all there.  I tried everything you mentioned before
    I went directly to the table's default browse.  After I figured out that the 
    script was OK I remove the "zap" & just deleted the records in Pup_Length Tab
    that matched the linking field of the current record. (to allow for changes)
    
    Zap is supposed to have exclusive RW in order to work but it did work from
    within the open set.  I'm now thinking that was the reason for the target
    browse not refreshing.  I will try it again without closing & re-opening
    the form later this evening. Once I removed the "zap" from the script closing
    & re-opening the form looks no worse than refreshing the form!
    
    I appreciate your intrest & your comments, I will let you know if the 
    zap was in fact the problem.  
    
    If anyone can give me other alternitives to this please advise!!
    
    ~doug

  8. #8
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,649

    Default RE: embedded browse & .refresh()

    I don't have an answer. My thought would have been to try John Zaleski's suggestion - fetch_first/last or force a pg_up/dn, and/or maybe browse.activate + sys_send_keys("{F5}"). But tell me the secret. How do you imbed those great graphics on this web site?

    PS I love the sheet metal background. Totally cool!

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

    Default RE: embedded browse & .refresh()

    Hi again Doug:

    I'm like Peter; just want to applaud that virtuoso presentation. Hats off.

    Bill

  10. #10
    Former Alpha Employee JerryBrightbill's Avatar
    Real Name
    Jerry Brightbill
    Join Date
    Apr 2000
    Posts
    5,173

    Default RE: embedded browse & .refresh()

    Doug,
    I feel your pain. Took a while, but I found a workaround. I have a set that links the same table 4 times to the same parent. (Don't ask why - it would take too long to explain) If I use xbasic to add records to the child, they don't display. It seems to be a problem with the indexes not being able to update correctly if another instance of the child table is open as it is when the set is open. The only solution was to close and reopen the form. Then the indexes are ok and the records display. I created a small message form to tell the user what is happening. At the end of the xbasic script that adds records, I get the record number of the parent and save it to a variable. I also set a logical variable I call reload to .T. Then I open the message form and close the main form with the script. On the OnTimer event for the message, I reopen the main form. I set the timer for 1 to 2 sec. On the main form OnInit I check the variable Reload and if it is true, I use the saved record number to find the record I was working on. I also close the message form with the main form OnInit event.

    Kinda messy, but it works and the process is transparent to the user. No other approach worked. On my app, I get a similar problem as well as heap lock failures and other fun if I delete a child record. After a delete, I use the same process and add a reindex to the child records before the message closes. I haven't tried V4.5 yet to know if the changes to the indexing will help these problems.

    Jerry

  11. #11
    "Certified" Alphaholic
    Real Name
    JohnZaleski
    Join Date
    Oct 2000
    Posts
    1,736

    Default RE: embedded browse & .refresh()

    Jerry,
    It looks to me like Doug has two different tables being linked to the ISO parent, "SPOOL" and "PUPS", and that he is trying to write records from the spool table to the pups table with the potential for some of the spool records to be summarized into a single record in the pups table. Do you think the problem you encountered with multiple instances of the same table is applicable here?
    John

  12. #12
    Member
    Real Name
    Doug Chanley
    Join Date
    Apr 2000
    Posts
    563

    Default RE: embedded browse & .refresh()

    Thanks guys for your input, I am sure that the mistake was
    on my part. I was using "zap" to empty the target table without
    exclusive RW access. I know that is why the browse did not
    show all the records written to it. Once the script was to
    my liking, I removed the zap statment & the target browse
    refreshed the new data without a problem!

    BTW the zap function worked even without exclusive RW access.....
    but if you use it that way you will probably get more than you
    barganed for!!

    ~doug

  13. #13
    "Certified" Alphaholic
    Real Name
    JohnZaleski
    Join Date
    Oct 2000
    Posts
    1,736

    Default RE: embedded browse & .refresh()

    Doug,
    Glad everything worked out
    My guess is that when you opened the table in your script you used something like:
    T = table.get("lines")
    All you are doing here is getting a pointer to a table already opened. Therefore the zap was allowed because no other instance of the table was opened. My guess is that if you used something like:
    T = table.open("lines")
    and then tried to zap it you would get an error because at that time you do not have exclusive access to the table. In my experiences, I've seen a little different behavior from Alpha in forms when there are no records in a table (like you had after the zap).

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

    Default RE: embedded browse & .refresh()

    "In my experiences, I've seen a little different behavior from Alpha in forms when there are no records in a table (like you had after the zap)."

    For example, I know but sometimes forget that a browse based on an empty table goes into enter mode when opened. Probably this applies as well to an embedded browse.

    I wondered whether this might have been related to the goings on in this case but who knows?

    Bill

Similar Threads

  1. How To Refresh Embedded Browse
    By Mike Thomson in forum Alpha Five Version 6
    Replies: 4
    Last Post: 09-21-2005, 06:35 PM
  2. embedded browse refresh
    By Cheryl Lemire in forum Alpha Five Version 6
    Replies: 8
    Last Post: 03-17-2005, 01:39 PM
  3. Refresh embedded browse on Enter?
    By CALocklin in forum Alpha Five Version 5
    Replies: 14
    Last Post: 08-05-2003, 07:49 PM
  4. Embedded Browse Refresh/Resync
    By John Dodson in forum Alpha Five Version 5
    Replies: 12
    Last Post: 04-24-2003, 06:12 PM
  5. embedded browse refresh
    By Don Holtz in forum Alpha Five Version 5
    Replies: 4
    Last Post: 09-24-2002, 05:04 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
  •