Also, does this mean I need to add to the startup script a variable capturing the information in Services1Text?
Actually, you didn't explain enough. You list three different tables, people, users, and EOC as well as (ick) a repeating field and do not report the relationships linking them, the context of what layout (and thus what table occurrence) is active at the time this script step executes nor what calculation you have defined for Services1Text. Since Services1 appears to be a repeating field, this calculation has to be defined correctly or it will only refer to one repetition of the repeating field.
That said, you can use PatternCount to search for text contained in quoted text, a text field or a calculation that has text specified as a result type.
If [ PatternCount ("AppleSauce" ; "Apple" ) ] will be true in all cases.
If [ PatternCount (YourTable::Field ; "Apple" ) ] will be true if the text "Apple" appears anywhere within YourTable::Field.
Apologies, people and users were referring to the same thing, I didn't mean to write them differently.
The two table are related to each other by the PK in Users to the FK in EOC.
Basically I want
if Field1=$$Service and EOC_Location = Part of the string found in Services1Text then go to Layout X
Show custom dialogue.........etc etc......its matching that one field to within my text string of Services1Text that is not working for me. The script works fine for me if that one step isnt there.
So your relationship is:
Users::__pkUserID = EOC::_fkUserID
Sorry, but these posts don't fully answer my questions. Posting your script might help as we need to know what layout (and thus what table occurrence) is current at the time that your script executes. That may or may not be revealed by showing us the actual script steps. Are you on a layout based on Users or EOC when it executes?
And in what table did you define "field1"?
Part of the string found in Services1Text
That sounds like something where you can use the PatternCount function as I described previously.
Yes you are correct, that is the relationship.
The layout that the button to execute the script is on is based on the EOC table.
Field 1 is on the EOC table as well.
There is nothing else to the script now really that would help as the is the beginning part of it which is causing the issue. it works fine if its only part of that if statement.....like this.
Go to layout [Layout X (EOC)]
Show Custom dialogue ["Access Denied"; "You do not have access to this page"
I've tried adding to the if statement with pattern count saying If [EOC::Field1=$$Service and PatternCount (EOC::EOC_Location; Users::Services1Text .....doesn't work.
If [EOC::Field1=$$Service and PatternCount (Users::Services1Text ; EOC::EOC_Location ) ]
Still gives the custom dialogue
You've mentioned that Users::Services1Text is a calculation field. Can you describe it in more detail? Is "Text" selected as the result type? What does it do with the data in the repeating field? Is it also a repeating field?
And there are other ways to control access to different layouts. You can set up privilege sets for different users and specify which layouts they are permitted to access. Then your script could just use Get ( AccountPrivilegeSetName ) to determine whether or not they are permitted to access a given layout.