It's hard to enlarge your screen shot large enough (in the future you can upload several screen shots, each to a different message post in this thread to get them larger), but I believe I see:
If [ Get ( LastMessageChoice ) = 2]
If this if FileMaker 11 or older, data entered into an input field in a custom dialog is committed back to the current record ONLY when Button 1 is clicked. In FileMaker 12, any button in the dialog can commit the data, but you have to select the option to commit the data.
So I think you need to swap your labels for button 1 and button 2 and change the above script step to:
If [ Get ( LastMessageChoice ) = 1]
I have resent the script and custom dialog boxes as it didnt change. I am working on FM 12.
Does the custom dialog successfully display the current record's receipt number twice? (Once as the field label and once as data in the field?)
Is that really what you want?
It seems odd to me that you would modify the ReceiptNo field of an existing record in this fashion, but since there is no go to layout step in your script, I'm wondering if you are on the correct layout when you perform this script. (Should be layout based on RentalCard or possibly a layout based on a TableOccurence that is linked to RentalCard in a valid relationship.)
Also note that you are using the "match found set" option in Go To Related Records. That could bring up a found set of many different records--many of which that are not related to the record where you just changed the receipt number to a new value.
Your GTRR step also appears to match to the same table occurrence as that of your current layout. If the "Show only related records" option were specified, this would "clone" the current found set in the specified layout. I've never tried that with the "match found set" option so can only note that this set of parameters for GTRR is very unsual--very possibly producing a set of records that is not what you wanted.
The receipt number needs to be inputed from the custom dialog, the field is blank before this. I am not processing the payment through the filemaker database, at this stage, Im leaving that for next years thing to tackle. So am just wanting to place the receipt number which is produced from our seperate POS system on to the layout as a cross reference. Up till now we have used manual rental cards for tracking gear which doesnt give us an effective system when customers return wanting the same gear hired before.
This is my first Database, which I have been working on by myself in my spare time for months, learning as I go, but we are committed to start running in our coming winter, next month, as we have just purchased all the ipads to run it on.
So at this stage FM will only track the customers and what gear they have rented and going through prcesses the different status of the rental "Queuing" "Gear Done" "Paid Gear Out" then "Returned"
This script that Im asking about has records from the current family with "Gear Done" status and Im wanting it to loop through the found set and change status to "Paid Gear Out" and enter the "Receipt No." in their allocated fields.
The Current Layout is based on "Rental Line Entry" Table. When I run the GTRR with match only, it drops off the other family members, I think I started using "Match found set" it as it was working but didnt realise I was wrong, but I seen it open up a whole lot of different records in another script where I ended up with 150+ new records when I only expected 3.
I think my brain is a little stuck here. Do I need to create a new T.O. here to be using the GTRR properly?
I can see when run through the scriptbugger, the receipt number from the customer dialog is actually working but getting replaced with nothing when I try reusing the $Receipt variable, I thought the variable lasted the length of the script. I have now added another "Set Variable" step after the GTRR step and before GT/record/reques/first but still need help on using this GTRR correctly. What do you suggest?
The receipt number needs to be inputed from the custom dialog, the field is blank before this.
Then your custom dialog will not show any label for your input field as you have set it up to show the contents of this field as the field label.
The Current Layout is based on "Rental Line Entry" Table.
That may be a problem as there may not be a valid relationship to Rental Card at the time that you perform this script. If there is no valid relationship, the script cannot enter data into a related record in the Rental Card table.
What relationship have you defined between Rental Line Entry and Rental Card? Is it possible that there is no record in Rental Card linked to the current record in Rental Line Entry at the time this script is performed?
but I seen it open up a whole lot of different records in another script where I ended up with 150+ new records when I only expected 3.
That would indicate a problem with either the relationship or the data in a match field at the time the GTRR was performed. You may find this thread on GTRR helpful: The Complete Go To Related Record
My relationship Tables are; fkNames-pkFamily / pkFamily-fkRentalcard / pkRentalcard-fkRentalLineEntry / fkRentalLineEntry-pkRentalItems. All unique __pkIDnumber generated on creation. I do have other table occurances done for portals, but I seem to be stuck on the fact that this is part of the general workings of the database, so it needs to be done with only the main relationships.??? I will have a look at your link. Thanks
My relationship Tables are; fkNames-pkFamily / pkFamily-fkRentalcard / pkRentalcard-fkRentalLineEntry / fkRentalLineEntry-pkRentalItems
I can't decipher that. You've listed a bunch of match fields without identifying the tables where they are defined.
Sorry - here is a screenshot of main rekationship tables
First observation: you have a many to one relationship from RentalLineEntry to RentalCard. If you have a found set of RentalLineEntry records that are all for one RentalCard at the time the script executes, this step will produce a found set of a single record on the RentalCard layout regardless of whether or not you use the Show current record or Match found set options.
However, If you have a found set of RentalLineEntry records for multiple RentalCard records, this same step will pull up multiple RentalCard records.
I don't know if that's the case or not, but if it is, you can remove the looping part of your script and replace it with a single Replace Field Value script step to do the same thing. You'd use two such steps, one to assign the quoted text and one to assign the Receipt no.
Your script fails because show custom dialog cannot assign a value to a variable. Your set variable step needs to be located after the show custom dialog step where the user inputs the receipt no, not before it. And I'd remove the reference to $Receipt from your custom dialog as it will always be empty when your show custom dialog step is performed.