Newbies mbwolf Posted February 8, 2006 Newbies Posted February 8, 2006 (edited) Hi I have various layouts that use Buttons with go to related record scripts to navigate each record set. These will only work if there has been a record created on those layouts. If no related record exists i can not access that layout unless i use a second button scripted to, go to (whatever) layout & then create a new record.This works But i think i have to many buttons & scripts What i would like to do is go to related record/& if no record exists create a new related record. Is this what i should be trying to do & if so how do i script this. I have never written/understood scripts. Also is there a way to dissable the close button on the window title/header bar Mac/Win Thanks in Antisipation of your kind advise. Edited February 8, 2006 by Guest
Søren Dyhr Posted February 8, 2006 Posted February 8, 2006 I have never written/understood scripts. It must be about time you take the plunge!! Well I would have an invisible button covering every field in the portal line, connected to a one-liner GTRR(SO) But to create a new line would I have a button that just does like this: If [ not Count ( ItemLines::ForeignKey ) ] Go to Layout [ “ItemLines” (ItemLines) ] Else Go to Related Record [ From table: “ItemLines”; Using layout: “ItemLines” (ItemLines) ] End If New Record/Request Set Field [ ItemLines::ForeignKey; Get ( ScriptParameter ) ] Where the button is assigned a value for the Get(ScriptParamter) to use ...here the parentrecords ID. is there a way to dissable the close button on the window title/header bar Mac/Win Yes! http://www.newmillennium.com/index.php?src=directory&view=products&srctype=display&back=products&id=15&submenu=Developer_Software&view=products&category=Developer+Software&pos=0,50,13 --sd
mvincenti Posted February 8, 2006 Posted February 8, 2006 I had to do the same thing with one of my databases. My solution is different than Soren's (and Soren really seems to know his stuff so I might trust his answer more than mine) however, this works perfect for my situation. Portals aren't involved with my situation but instead, in order to keep this a "related record", I must copy the appropriate information into the the newly created record (since an existing one was not found). Therefore, my script looks like this: If [Repair Ticket::repairid > 0] Go to Related Record [From table: "Repair Ticket"; Using layout: "Repair Ticket" (Repair Ticket)] Else Copy [select; Service Ticket::ticketid] Go to Layout ["Repair Ticket" (Repair Ticket)] New Record/Request Paste [select; Service Ticket::ticketid] Go to Field [Repair Ticket::History] End If (Since each "Repair Ticket" has a unique ID, I'm telling Filemaker to find out if the related Repair Ticket ID is greater than zero- if it is, go to that record. if it isn't, that is, if the record does not exist and therefore returns a null result (resulting in a zero), create a new Repair ticket and automatically enter the ticketid so that this new Repair Ticket is related to the Service Ticket. Also, I am telling Filemaker to automatically go to a specific field as well- this isn't necessary but convenient.) I am certainly no wizard when it comes to scripting but when I have to make a script, I go through the steps manually very slowly, taking note of every step. Then I go to the scriptmaker and repeat the steps command by command. If it doens't work the first time (rarely it does), it usually takes just a little tweaking to correct my commands. Hope that helps... this is my first attempt to help someone else in this forum! Everyone else has been so kind and helpful to me!!
Søren Dyhr Posted February 8, 2006 Posted February 8, 2006 Well we're doin the same ...except you're using Copy/Paste, which is a little iffy - as developers aren't we supposed to tamper with the users clipboard. Why? The user might have stached an image away in it say of his love-ones which he thougt was about to paste into a web publishing tool, when a customer called and ordered a wagonload of item X ...the invoice is made and ......wuoosh, where has the image gone - ******* modern technology! --sd
aldipalo Posted February 8, 2006 Posted February 8, 2006 Soren: I agree with your thinking, but, I have more iffy results with SetField than copy/paste in scripts. I am sure this is a lack of understanding of the command and how to properly use it. Also, can you give us any documentation to read on both SetField and Get(ScriptParameter) as that is another command that is not well documented in FM Help. Thanks, Al
Newbies mbwolf Posted February 8, 2006 Author Newbies Posted February 8, 2006 He Thanks Guys I just learnt something About Scripts I thought i would never Get it. After a bit of organising the order of execution (i am sure you did it deliberatly so i would Play with it) I Ended up with if [no count (Job schedule::ContactSerNum_fk )] Go to Layout ["Jobschedule" (Jobschedule)] New Record/Request Set Field [JobSchedule::JobStatus] Else Go to Related Record [From Table: "Jobschedule"; Using Layout: JobSchedule" (JobSchedule)] End if This is the first time i have got it. Many thanks
Søren Dyhr Posted February 9, 2006 Posted February 9, 2006 (edited) Also, can you give us any documentation to read on both SetField and Get(ScriptParameter) as that is another command that is not well documented in FM Help. You better explain whats wrong with these two: http://www.filemaker.com/help/Script-Steps37.html http://www.filemaker.com/help/FunctionsRef-261.html ...how could they be better documented? How should documentation work anyway? How would you document the Pythagorean Theorem for instance - we all use it as a tool to tell the distance between two points, on a daily basis - without even thinking of the proof. I think you better approach it in another way: To hell with documentation lets tear appart every template I can lay my hand on: http://www.databasepros.com/ http://www.dwdataconcepts.com/ http://www.nightwing.com.au/FileMaker/demos.html#fmp8 http://www.newcenturydata.com/downloads.php --sd Edited February 9, 2006 by Guest
aldipalo Posted February 9, 2006 Posted February 9, 2006 Thanks Soren: The bottom 4 are very helpful and as I said FM help screens leave a lot to be desired. Perhaps, if you are an experienced Programmer/developer their brief explanations are enough. For newbies there are no real explanations as to what the command is and in what different ways it can be used. What I have been able to learn over the past 4 months has been primarily on this forum and the links that you and others have provided that give valuable examples and more detailed explanations of functions, etc. BTW, Pythagoras' Theorem claims that the sum of (the areas of) two small squares equals (the area of) the large one. In algebraic terms, a2 + b2 = c2 where c is the hypotenuse while a and b are the sides of the triangle. The theorem is of fundamental importance in the Euclidean Geometry where it serves as a basis for the definition of distance between two points. I was able to Google that! http://www.cut-the-knot.org/pythagoras/index.shtml Anyway, as usual you are a wealth of knowledge and I don't care if you give us less experienced folks the answer or the place to find it. Actually, in the long run, I'd rather you bring me to the water, as long as it is pure, and I'll learn how to drink it. But, it's nice to know if I just can't see the river you'll be there to show it to me. Thanks again. Al
Baylah Posted February 11, 2006 Posted February 11, 2006 (edited) One of the main reasons I never want a "real" developer to look at some databases I have designed is because of the "work arounds" I have had to create because I don't understand all of the available tools. A real "developer" would look at some of my scripts and calculations and say "What the hell was this guy thinking!" But, the solutions all work, just not as elegantly as they could. I keep learning more and more from this amazing forum and thanks to folks like Soren I have been able to create some pretty robust solutions, albeit messy in the background. Tools like "set Field" and "Goto related record" are invaluable and I am only now beginning to understand the true power of these relatively straight forward concepts that I could never figure out form the FMP documentation. Steve Edited February 11, 2006 by Guest
SteveB Posted February 11, 2006 Posted February 11, 2006 If you find the FM documentation either too difficult or too brief, get a text book like Special Edition Using Filemaker 7 by Steve Lane, et. al. Although it only covers up thru 7, it will prove invaluable. Steve
Recommended Posts
This topic is 6863 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