Jump to content
Sign in to follow this  
pro-phile

Finding range in currency

Recommended Posts

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!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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