July 15, 201510 yr Hi All, I'm struggling with a script and count see what I'm doing wrong. The frustration is its a simple script. For some reason the script will not action the second option. If red it will run red script if blue it will run blue script, but if green it moves down to the blue if and runs the blue script. I'm so confused. The script is just a trigger to run another script all three of which are the same just with different layouts. Any advice appreciated.
July 15, 201510 yr One reason is that "Green" is never set to Contacts::Groups. Could be a trailing space, a return or some other invisible charactar. Another reason could be that when the script runs you are not on the "Contacts" context or on any context with a meaningful relationship to Contacts.
July 15, 201510 yr For some reason the script will not action the second option. If red it will run red script if blue it will run blue script, but if green it moves down to the blue if and runs the blue script. Check if Group really is identical to the queried value(s) – maybe there is a blank? Put another copy of the field without a trigger on the layout and check the content. Also, is Group a text field? Also note that the final If[] does not explicitly check on Blue – it's just a default for everything that is neither Red nor Green. The script is just a trigger to run another script all three of which are the same just with different layouts. Then why not use a single script that selects the layout depending on the field contents (e.g. by calculation) – or maybe even just a single layout and have the script do some customization? Edited July 15, 201510 yr by eos
July 15, 201510 yr Author Check if Group really is identical to the queried value(s) – maybe there is a blank? Put another copy of the field without a trigger on the layout and check the content. Also, is Group a text field? Then why not use a single script that selects the layout depending on the field contents (e.g. by calculation) – or maybe even just a single layout and have the script do some customization? I'm not massively advance with calculations. I did try this but couldn't make it work. Any pointers appreciated. Many thanks Incedently, when I change the script around so that blue is the middle step it then skips blue and goes to green layout. This makes me think it's something other than specific to "green"
July 15, 201510 yr I'm not massively advance with calculations. I did try this but couldn't make it work. Any pointers appreciated. You don't need to be “massively advanced”… If you have three layouts called Layout_Red, Layout_Green and Layout_Blue, you could use the script step Go to Layout [ by calculation: "Layout_" & Contacts::Group ] If you have a multi-purpose layout with no direct relation to a selected value – e.g. Layout_Red, Layout_Green and Layout_Others – use the calculation Let ( g = Contacts::Group ; "Layout_" & Case ( g = "Red" or g = "Green" ; g ; "Others" ) ) On the other hand, I would investigate if you really need three layouts that are (presumably) very similar. What will happen when you introduce Group Purple? – Better not forget to create a new layout, and amend the script … For your current issue: did you use another field copy to check the actual field contents at the moment of script execution?
July 15, 201510 yr You are not providing enough information to enable us to help you. I would suggest you start by changing your script slightly to: If [ Contacts::Group = "Red" ] Perform Script [ “Red_Email_Script” ] Else If [ Contacts::Group = "Green" ] Perform Script [ “Green_Email_Script” ] Else If [ Contacts::Group = "Blue" ] Perform Script [ “Blue_Email_Script” ] Else Show Custom Dialog [ Message: Contacts::Group; Buttons: “OK” ] End If That will tell you what the actual value in Contacts::Group is, when it isn't one of the three you have provided for explicitly. Edited July 15, 201510 yr by comment
July 15, 201510 yr I don't see anything about layouts in the original question. The script is just a trigger to run another script all three of which are the same just with different layouts.
July 15, 201510 yr Yes, I have noticed that, and deleted that part in my post. Still, I don't think that has anything to do with the problem here. OP is complaining about the wrong script running. I believe it's quite clear the reason is that the field in question does not contain the value that OP thinks it does. Edited July 15, 201510 yr by comment
July 15, 201510 yr Author This shows the colour group under group heading which is in a drop down menu I have changed my script as advised and blue and red still populate while green comes up with message box with Green written inside
July 15, 201510 yr Author Check the character count of the value you expect to = "Green" and see if it is 5 thanks Kris. How would I check this. So sorry
July 15, 201510 yr Author Or attach a copy of your file. Hi Lee, Please see the file uploaded. many thanks for allowing em to do this Contacts Copy.fmp12
July 15, 201510 yr green comes up with message box with Green written inside What do you see if you change the message to = Quote ( Contacts::Group ) Edited July 15, 201510 yr by comment
July 15, 201510 yr Author What do you see if you change the message to = Quote ( Contacts::Group ) same
July 15, 201510 yr There is a blank in the Group value list's entries for “Blue” and “Green” – which you could have found out much earlier by following the suggestions you were given … After you've corrected the values in the list, don't forget to do this also for the Group field value in the existing entries.
July 15, 201510 yr Author There is a blank in the Group value list's entries for “Blue” and “Green” – which you could have found out much earlier by following the suggestions you were given … After you've corrected the values in the list, don't forget to do this also for the Group field value in the existing entries. Hi, I'm so sorry but I think I must be being a little dense I cannot see the blank in the value list entries. So sorry.
July 15, 201510 yr Author thank you to all who helped solves this. I feel foolish as it was, as stated by many just a space after blue and green colour. Very embarrassed, but very grateful.
July 30, 201510 yr Don't feel bad. The Mariner 1 rocket launch exploded. I had learned this was due to a missing semicolon (";") but apparently the truth is a little more subtle: https://en.wikipedia.org/wiki/Mariner_1#.22The_most_expensive_hyphen_in_history.22
Create an account or sign in to comment