pro-phile Posted August 24, 2002 Posted August 24, 2002 I need to find a range in currency between a field named "low rent" and a field named "high rent". I want to search for properties within a low and high rent range. I also don't want to use the "find" view, I'd like to script it to a button to produce the found set in a portal. Any ideas? Thanks!
CobaltSky Posted August 24, 2002 Posted August 24, 2002 This can be done by creating an additional global field (let's day called 'gRanges') which acts as a multi-key field for a relationship (which is the basis of your portal). Once the low and high amounts are entered into global number fields provided for the purpose, your script should then run a looping procedure to increment the lower value by one, adding each result (separated by a carriage return) to the 'gRanges' field, until it reaches the high amount. The gRanges values will then match to any corresponding values in the related file, and they will be displayed in the portal.
danjacoby Posted August 25, 2002 Posted August 25, 2002 Assuming you have a bunch of records, each with a value in a "RentAmount" field, and you want to be able to enter values for "LowRent" and "HighRent" and then search to see what fits... Create two global fields, gLow and gHigh, that return numbers (oh yeah, the RentAmount field should be a number too). Then when the fields are filled in, have the button activated script: Enter Find mode Set field ["RentAmount", "gLow and "..." and gHigh"] Perform Find That should do it.
Keith M. Davie Posted August 25, 2002 Posted August 25, 2002 While that should do it, things always seem to be more complex when put into actual use. You may want to include a conditional or two to or three into the script", e.g. If ["IsEmpty(glow) or IsEmpty(ghigh)"] Show Message ["Two numbers are required for a range."] Halt Script Else Set Error Caputre [On] Enter Find Mode [] Set Field ["RentAmount", "gLow and "..." and gHigh"] Perform Find If [" Status(CurrentError) = 401 "] Clear [select , "gLow"] Clear [select , "gHigh"] Show Message [" No Records, try another set of numbers "] Else *here you might add navigationals to a "show record" layout if only one record is found else a "view list" layout if a number of records are found, and in those Else-If conditionals also clear the global fields so the next user does not find the fields populated. Then use as many end-ifs as necessary.
Fitch Posted August 25, 2002 Posted August 25, 2002 Yo, Old Hands, he said he wants it in a PORTAL. I suggest a combination of the scripted Find and the multi-line key field: 1. Perform the Find as in the scripts above. Script this: 2. In the child file, go to a layout that has ONLY the record id (or serial number, or whatever you want to call the unique identifier of the record -- you do have one, I hope?) 3. Copy All Records 4. In the parent file, go to a layout that has a global text field on it, let's say gText, and Paste 5. Your portal should be related gText::record id All done! Note 1: by "parent" file, I mean the one on the left side of the relationship, even if we're talking about a self-join -- child file is on the right. Note 2: I would add to Keith's script that users tend to be annoyed when you clear the fields after a Find. Better to do a Modify Last Find so they can see the values they already tried -- Maybe they only need to change one of them.
Keith M. Davie Posted August 25, 2002 Posted August 25, 2002 Chili beans. I guess I read it half-fast and answered it the same way.
Recommended Posts
This topic is 8124 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