` Printed Icetips Article

Icetips Article



ABC: Position a child browse on saved value
2001-11-26 -- Dennis E. Evans
 
Newsgroups: softvelocity.products.c55ee

> I have a situation where there are two linked browses, and it's
> the child file that may need to be positioned to a specific
> record selected in a prior session AFTER the parent record is
> selected, depending on a user code and saved value.

A little different but not difficult.    I will assume the child is
linked by a key with two fields and is also sorted by the that key.    Or
the child is linked by a key with one field and sorted by a field in the
additional sort fields.

   Depending on which fields you have saved from the child file.

   1.   Second sort field is the saved value,

         ChildFile:Field = Saved Value
         ChildBrw.ResetFromBuffer()
          select(?childlist)

If the first field is linked then it will already be filled.   All you
need to do is prime the second field and reset from buffer.

   2.   if the value you have is from a different key

         SaveLinkField = Current Child Link
         ChildFile:KeyField = Saved Value
         Access:FielSpec.TryFetch(key)
         Current Link Field = SaveLinkFiled
         ChildBrw.ResetFromBuffer()
         select(?childlist)

This uses the key that was saved to prime the buffer and then just
resets to that location.

You may need to alter those a little depending on how and what values are
being saved, but if you fill the sort fields and then call ResetFromBuffer
the browse will locate the correct record.   The sort fields can be
components of a key or fields added with the AppendOrder (Additional Sort
Field prompt).     The parent browse can also be reset based on a child
record selection using the same idea.

    Dennis



Printed November 23, 2024, 3:38 am
This article has been viewed/printed 35384 times.
Google search has resulted in 7 hits on this article since January 25, 2004.