eddiedredge Posted July 15, 2015 Posted July 15, 2015 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.
Wim Decorte Posted July 15, 2015 Posted July 15, 2015 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.
eos Posted July 15, 2015 Posted July 15, 2015 (edited) 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, 2015 by eos
eddiedredge Posted July 15, 2015 Author Posted July 15, 2015 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"
eos Posted July 15, 2015 Posted July 15, 2015 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? 1
comment Posted July 15, 2015 Posted July 15, 2015 (edited) 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, 2015 by comment
eos Posted July 15, 2015 Posted July 15, 2015 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. 1
comment Posted July 15, 2015 Posted July 15, 2015 (edited) 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, 2015 by comment 1
eddiedredge Posted July 15, 2015 Author Posted July 15, 2015 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
Kris M Posted July 15, 2015 Posted July 15, 2015 Check the character count of the value you expect to = "Green" and see if it is 5
eddiedredge Posted July 15, 2015 Author Posted July 15, 2015 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
eddiedredge Posted July 15, 2015 Author Posted July 15, 2015 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
comment Posted July 15, 2015 Posted July 15, 2015 (edited) 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, 2015 by comment 1
eddiedredge Posted July 15, 2015 Author Posted July 15, 2015 What do you see if you change the message to = Quote ( Contacts::Group ) same
eos Posted July 15, 2015 Posted July 15, 2015 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. 1
eddiedredge Posted July 15, 2015 Author Posted July 15, 2015 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.
eos Posted July 15, 2015 Posted July 15, 2015 I cannot see the blank in the value list entries. So sorry. 1
eddiedredge Posted July 15, 2015 Author Posted July 15, 2015 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.
xochi Posted July 30, 2015 Posted July 30, 2015 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
Recommended Posts
This topic is 3677 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