broberts7usa Posted August 8, 2003 Posted August 8, 2003 --- or maybe it's me who is very simple. In my properties database, I have a "find" layout set up so that a series of records (for which you already know the property ID) can be located and displayed in a list report. I've already got a self-relationship called "multi-key for find" and there's a global field on it gPropertyIDs into which you can type: 1286 1157 etc (with a carriage return between)and then a "find" button with the script below: Set Error Capture [On] Allow User Abort [Off] Go to Related Record [MultiKey for Find] [show only related records] Set Field [gError, Status(CurrentError)] If [gError=400] Show message [buttons: "OK", "", ""; Data:"You didn't enter any property IDs."] Go to Layout [original layout] Else Go to Layout [List Found Properties] End If Clear [gPropertyIDs] [select entire contents] Simple, right? So why doesn't it work? It finds a series of propID numbers easily, and displays then in the correct report layout. However, if you go back and look at the "find" layout, the ID numbers are still there (the "clear" instruction in the script isn't working) and if the global gPropertyIDs is empty and you run the script, the error message does not appear at all, and it shows you a blank list report layout (with no records on it). Any clues, anyone? Is there something going on related to switching back and forth between the different layouts, that I have forgotten since not Filemakering during July? Or am I the problem ? Thanks in advance -- Bonnie
slstrother Posted August 8, 2003 Posted August 8, 2003 To use the Clear script step, the field needs to be on the current layout. Try using Set Field[gPropertyIDs,""] instead.
broberts7usa Posted August 8, 2003 Author Posted August 8, 2003 Thank you, that worked perfectly (I knew it had to be something about the layout switch). I also figured out why the error thing wasn't working. Since a "find" using a global field is done in browse mode, not find mode, the error would NOT be 400 (find criteria empty), it would be 101 (record not found) -- but this may cause some confusion down the road if the user enters an ID number which does not exist. So I'm going to have to rethink both the message and the script, to give users the chance to go back and know which property ID got an error if they entered a whole string of them to put into a report. Any suggestions?
Wendy T Posted August 11, 2003 Posted August 11, 2003 hi Bonnie, I suggest using a test for the validity of the relationship before the GTRR step. Excuse the pseudo-code, but something like: if not isvalid(Multikey::PropertyID) then show error message & exit script else GTRR & continue rest of script.... As to the other problem of showing the user which property ID gives the error, I'll have to think on that one. Or perhaps someone else will jump in. cheers, wendy
Vaughan Posted August 11, 2003 Posted August 11, 2003 If you want to find wherther there are any related records, use the function Count(relationship::remotekey) > 0
-Queue- Posted August 11, 2003 Posted August 11, 2003 You don't need the "> 0" part either. You could also use relationship::constant as a boolean, assuming the constant is greater than zero. I always use that to test for existence and not IsValid(relationship::constant) to test for nonexistence.
Recommended Posts
This topic is 7779 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