FileMaker Back Button by RecordID

I need a back button, and it's not going to be easy.

The db I'm working on has >40 tables with over 100 layouts and (far too) many self-joins. I've installed Back Magic from Seed Code, but that only restores layouts and tabs, not individual records. The rest of the road I'm on has me stuck.

I tweaked back magic to store RecordIDs, as they are the only thing I can think of that is a universally accessible (meaning I don't have to specify what table::field I'm looking in), constant, unique identifier. So how do I get there? The self-join via global calc field method is impractical, as is using any single field name (all the table specific record ids are uniquely named and I really don't want to script a case statement that runs through every possible layout to determine which table and field to look at).

So, the only thing the internet has turned up as viable thus far is.... apple script. Here's what I have:
"set thisID to \"" & $recordID & "\" " & ¶ & 
"tell application \"FileMaker Pro\"" & ¶ &
"tell database \"LR_Database\"" & ¶ &
"show record ID thisID" & ¶ &
"end tell" & ¶ &
"end tell"

and it works.... half of the time. The other times I get "Object Not Found" and "Unknown Error: -1728" anyone know why? anyone have any other ideas? If it can't be done in 30-45 minutes with less than 5 new table occurances, I can't do it.
mcpillsburyAsked:
Who is Participating?
 
mcpillsburyAuthor Commented:
Well, it's not as elegant as I wanted and probably won't work over vpn, but I have an almost functional back button. It uses a slew of if statements to decide which field it should reference, and it has to run through it every time a layout/record change occurs and when the back button is pressed. I'll have to update the scripts every time I add a new table. Meh.

Thanks for your help lesouef- I'm going to close out the question.
0
 
lesouefCommented:
I am not sure 'show record', using the record ID works, because fm does not do it natively, so I doubt applescript can do it. try to remove that step as a test. if it turns out to be true, use recordnumber instead.
0
 
mcpillsburyAuthor Commented:
But it does work- about half of the time FM correctly jumps to the record ID and the other half it tells me object not found. Why for some record IDs but not for others (for instance record ids 57-142 load whereas 143-299 do not)?
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
lesouefCommented:
ok, ok... at=re these records still in the foundset when you try to display them again? or has the records foundset been changed in between by a further action?
0
 
jvaldesCommented:
Have you looked at a free product designed by seedcode called backmagic?
0
 
jvaldesCommented:
I think this solution will give you some great ideas on how to handle a back button, it did me...
0
 
lesouefCommented:
I think you did not read the question Juan, that's where he started!
0
 
mcpillsburyAuthor Commented:
the found set has changed. I'm ok with just displaying the record without the rest of the found set (in most cases it will be a record in one of three tables: People, People_on_Program, or Programs. we generally interact with these as individuals and not groups).
0
 
lesouefCommented:
yes, but it must be present before you navigate back to it. so can you do a 'find all' before trying to locate the record ID? or use a find instead of show?
0
 
mcpillsburyAuthor Commented:
sure- for that i need someway to set each table's id field on the fly. Do you know of a way to get the Set Field script step to specify a field by calculation?
0
 
lesouefCommented:
I am not with you... set field can use any calculation, so where is the problem?
0
 
mcpillsburyAuthor Commented:
sorry- let me clarify... I need to be able to set field based on context. If I'm on a layout that uses the people layout I need to search by person_id, for programs it's program_id. The set field step only lets me select from a list that references a specific field in a specific table.

To get around this I've tried Set Field with no field specified and then:
$table_and_field_name & "; " & $recordnumber
This mimics the Set Field [ Table::Field; Value ] format that the script editor uses, but doesn't actually evaluate out correctly. I've tried using the evaluate function in a number of creative ways as well, but that doesn't quite cut it either.

Thanks for sticking in here with me. I'm currently testing another AppleScript hack- passing the variable to AS and using it to generate the find request. So far I'm getting Unknown Error -10006 which I can't even find documentation for. Sigh.
0
 
lesouefCommented:
so, you wanna switch to a field of which the name is in another field or variable...
no, you can't do this, only the repetition can be defined.
and all you can do with eval is get the value from a field of which you specify the name as the eval argument, but that won't work for set field. I can't say more now, I don't know the seedcode solution, and can't spend time on it right now.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.