Matt Leach Posted March 12, 2010 Posted March 12, 2010 I have a login script setup that searhes for the logged in user's record in the database. My script is setup as follows: Enter Find Mode [] Set Field [Members::Email; Get ( AccountName )] Perform Find [] Show All Records The script appears to be ignoring the Show All Records command as i am still confined to the found set. The script step works flawlessly if it is in a script on its own. If the user were to manually click the Show All Records button, it works without a problem. I know that is an easy work around for the problem but i would like to script as much as i can as the users aren't very computer literate.
IdealData Posted March 12, 2010 Posted March 12, 2010 I can't quite see what purpose your script has, but let's deal with the problem. As you have FM Advanced then turn on the script debugger and see what error you are getting on the find request - it may be that the script is stopping.
Matt Leach Posted March 12, 2010 Author Posted March 12, 2010 No errors appear in the script debugger. Prior to this post i was testing the script in IWP, not the FileMaker app. When i launched the database using the app the script runs, but a message comes up saying No records match this set of find requests. What's odd is that the record is actually found in the background (see screenshot). I am logged in with an account name of [email protected] and it finds the record with an email of [email protected], but why does it say no records match the find request?
Matt Leach Posted March 12, 2010 Author Posted March 12, 2010 As for the purpose of the script, perhaps a little background on the project may help clear it up. The database is a member's database of retired NY police officers. Prior to this database, they had another software with all the members in it which only one or two people accessed. Since moving to filemaker, they wanted the members to be able to access the database and have permissions to edit only their own record. After having the database up for 2-3 weeks i was constantly getting emails saying when they opened the database they were not presented with their own record. So i took the approach of having the opening layout be a kind of search portal which search boxes for name, email, etc... I even wrote a short user manual walking the end user through searches. This prompted more emails saying that once they searched for their record they couldnt see everyone's record again. I then removed the status toolbar altogether and setup some basic navigation buttons again with instructions but that did not help any. My last step was to setup a script that would automatically bring them to their record which is where i'm at now. I originally setup the script to search their record but it became a problem for the user because unless they clicked Show All Records, they were locked to the found set, hense the need for the script to have the Show All Records step.
lawaid Posted March 12, 2010 Posted March 12, 2010 What's odd is that the record is actually found in the background (see screenshot). Hi. Looking at the screenshot, what I see in the background is not a "found record" ... it's the same window still in Find Mode, waiting for the search to be modified. I think the problems regards use of the "@" symbol in the search string. The "@" symbol plays a special role in FM Finds, where it represents "one character." To allow the "@" symbol to be included in a search, it will need to be preceded by an "escape" character, the "" key. See, Link Hope it helps.
Matt Leach Posted March 12, 2010 Author Posted March 12, 2010 question is how can i use an "escape" character as i am setting the email field in the search with Get ( AccountName ) Would i do something like: "Get( AccountName)"?
mr_vodka Posted March 12, 2010 Posted March 12, 2010 Enter Find Mode [ ] Set Field [ Email; Substitute ( Get ( AccountName ); "@"; "@" ) ] Perform Find [ ]
Matt Leach Posted March 12, 2010 Author Posted March 12, 2010 I will give that a try. Thank you all for your help, it is much appreciated.
bruceR Posted March 12, 2010 Posted March 12, 2010 Seems like this would be better solved and more easily solved with privilege sets. That positively prevents people from seeing other records. Then the only thing you have to do is modify the "Find All" menu choice so that it connects to a script, and the script does a find for "*" in a field like record ID (indexed field with a value in every record). All other more specific finds will only find allowed records.
Recommended Posts
This topic is 5638 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