Jump to content

This topic is 3165 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

 

 

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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?

  • Like 1
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

 

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
  • Like 1
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

  • 2 weeks later...

This topic is 3165 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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