Newbies nangko Posted July 17, 2008 Newbies Posted July 17, 2008 Selecting a record by pk_id in a script to update record-data. What is better? Scripting a "Find" or using a "Go to Related Record". I think that a filemaker handles a "Go to Related Record" scriptstep (by using a global temp_fk_id) faster then scripting a search on the primary key.
Søren Dyhr Posted July 17, 2008 Posted July 17, 2008 I would say when you shave away the setting of the field in findmode, and compare the actual Perform Find with the GTRR is probably the same. What you might notice is if you layout is just a tiny bit bloated, could you scripting benefit from a: http://www.filemaker.com/help/ScriptsRef-28.html You should in the same time be aware that when a match doesn't exist, will the GTRR stay in the same layout just as the Find would, but if it does exist could you easily be taken to a new layout where you have been so careless to show a summaryfield. But then comes a reservation to the entire purpose of you scenario, a GTRR with a following scripted replace of the found set, might be a sign of insufficiently normalization - even though the GTRR should be dealing with a selfjoin! --sd
Newbies nangko Posted July 17, 2008 Author Newbies Posted July 17, 2008 You should in the same time be aware that when a match doesn't exist, will the GTRR stay in the same layout just as the Find would, but if it does exist could you easily be taken to a new layout where you have been so careless to show a summaryfield. Your point is that the summaryfield slows the process?? But then comes a reservation to the entire purpose of you scenario, a GTRR with a following scripted replace of the found set, might be a sign of insufficiently normalization - even though the GTRR should be dealing with a selfjoin! Maybe I should refrace my question in: "Best practice to go to a record by primary key". - Scripting a find (enter find mode, set field(_pk_id,$customer_id), perform find) - Or by using a Go to Related Record script step (set field(_temp_fk_customer_pk_id,$customer_id), Go to Related Record(user_layout,tbl_user)) - Or ... ?? (other suggestions)??
Fenton Posted July 17, 2008 Posted July 17, 2008 As Søren says, the speed is probably about the same. I would think the relationship is faster, but since both are close to instantaneous, it's hard to say. As far as "best practices," I would say the relationship is better. It only requires 3 lines of code: If [ not IsEmpty (relationship::key) ] Go To Related Record ( relationship, layout ) End If It would require several more lines to do this as a Find. And the relationship would likely have other uses. But often it's not worth creating a relationship for Find. But for a primary key? Yeah, it usually is.
Newbies nangko Posted July 18, 2008 Author Newbies Posted July 18, 2008 Thanks for your reply. From now on I will use GTRR for navigating to the record by primary key. :P
Recommended Posts
This topic is 5971 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now