Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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. 

 

Screen_Shot_2015-07-15_at_11.32.02.thumb

 

 

 

 

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.

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 by eos

  • 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"

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?

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 by comment

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.

 

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 by comment

  • Author

 

This shows the colour group under group heading which is in a drop down menu

Screen_Shot_2015-07-15_at_11.16.52.thumb

Screen_Shot_2015-07-15_at_13.49.33.thumb

Screen_Shot_2015-07-15_at_13.48.03.thumb

 

I have changed my script as advised and blue and red still populate while green comes up with message box with  Green written inside

Screen Shot 2015-07-15 at 11.17.03.png

Check the character count of the value you expect to = "Green" and see if it is 5

Or attach a copy of your file.

  • 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

  • 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

green comes up with message box with  Green written inside

What do you see if you change the message to =

Quote ( Contacts::Group )

 

Edited by comment

  • Author

What do you see if you change the message to =

Quote ( Contacts::Group )

 

same Screen_Shot_2015-07-15_at_15.54.39.thumb

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.

  • 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. 

same

That's not possible.

I cannot see the blank in the value list entries. So sorry. 

Screen_Shot_2015-07-15_at_18.49.44.thumb

Another view of the problem.

Value List Errors.png

  • 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. 

  • 2 weeks later...

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.