Adding record changes

Using and extending SeedCode's free "back" button technique.
Posts: 2
Joined: Wed Jan 23, 2008 12:43 am
PostPosted: Wed Jan 23, 2008 12:51 am
I do like the idea of being able to track changes. I would like to add the current record into the stack. You stated this should be easy enough to do.
But could you please point me in the right direction.

Here is what I thought of

Create a custom function that returns the current record ID
add this function into the trigger layout_state (but how)
and then?
add a line to the log function like:
changed = SeedCode_GetValue ( topofstack ; "RecordNumber" ) ≠ SeedCode_GetValue ( navaddress ; "RecordNumber")

I'm stuck here, so any help would be much appreciated.
(FMP 9A, win XP)
SeedCode Staff
SeedCode Staff
Posts: 2493
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Wed Jan 23, 2008 9:45 am
Definitely on the right track. Adding the record number is pretty straight forward, but it rubs against adding the found set: which is not simple or, indeed, practical.

Adding the actual record to the stack works well unless the found set changes. If it does, then the script doesn't take you back to the right record. So, I've added a test that only attempts to navigate to the right record when the current found set matches the found set at the time the stack was recorded. This is OK, but you might try it with and without this in place to see which feels more natural to your users.

So, here are the changes you'll make to add the current record to BackMagic:

1. Edit the custom function "SeedCode_BackMagic_LayoutState"

Replace this...
Code: Select all
"LayoutNumber = " & Get ( LayoutNumber ) & " ; StatusArea = " & Get ( StatusAreaState ) & " ; TabObjectName = " & SeedCode_FrontTabName ( 1  ; LayoutObjectNames ( Get (FileName ) ; Get ( LayoutName ) ) )


...with this:
Code: Select all
"LayoutNumber = " & Get ( LayoutNumber ) & " ; StatusArea = " & Get ( StatusAreaState ) &

// NEW

" ; RecordNum = "  & Get ( RecordNumber ) & " ; Found = "  & Get ( FoundCount ) &

// END NEW

" ; TabObjectName = " & SeedCode_FrontTabName ( 1  ; LayoutObjectNames ( Get (FileName ) ; Get ( LayoutName ) ) )


2. Edit the custom function "SeedCode_BackMagic_Log"

After this...
Code: Select all
Let ( [
navaddress = SeedCode_BackMagic_LayoutState ;
topofstack = Substitute ( LeftValues ( $$Nav_BackStack ; 1 ) ; "¶" ; "" ) ;
changed = If ( SeedCode_GetValue ( topofstack ; "LayoutNumber" ) ≠ SeedCode_GetValue ( navaddress ; "LayoutNumber" ) or
SeedCode_GetValue ( topofstack ; "TabObjectName" ) ≠ SeedCode_GetValue ( navaddress ; "TabObjectName" ) ; 1 ; 0 )


...add this:
Code: Select all
// NEW

or SeedCode_GetValue ( topofstack ; "RecordNum" ) ≠ SeedCode_GetValue ( navaddress ; "RecordNum" )

// END NEW


3. Edit the script "Back FWD ( Direction )"

Right before the "adjust status area" comment, add the following:
Code: Select all
#
#NEW Go to Record
If [ SeedCode_GetValue ( $Destination ; "Found" ) = Get ( FoundCount ) ]
Go to Record/Request/Page [ SeedCode_GetValue ( $Destination ; "RecordNum" ) ]
[ No dialog ]
End If
#


That's it!
John Sindelar
SeedCode LLC
Posts: 2
Joined: Wed Jan 23, 2008 12:43 am
PostPosted: Fri Jan 25, 2008 10:12 am
John,

Thanks very much for your clear reply. I will test it and see if it works for my users.

Keep well, Ursus
SeedCode Staff
SeedCode Staff
Posts: 2493
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Fri Jul 16, 2010 9:56 am
Seems like custom validation message: I'd check the field validation or the running script to see under what conditions that dialog comes up.
John Sindelar
SeedCode LLC

Return to BackMagic

Who is online

Users browsing this forum: No registered users and 1 guest