Jump to content

Calculation Question


This topic is 1403 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi Guys, 

I have a Script running a calculation for a Find. 

The table is in essence as follows

Item Percentage Find Field

My Script/Calculation is as follows: 

Quote

Enter Find Mode [Pause: Off]

Set Field [Percentage ; Percentage ≥ Find Field ]

Set Error Capture [On]

Perform Find [ ]

Sort Records [Restore ; With dialog: Off]

Go to Record/Request/Page [First] 

 

I have an identical Script with text relating to the item. This works perfectly. 

For some reason the calculated field isn't. 

The input for this Find Field is entered as a decimal number (the setting of the the field turn it into a percentage). So if I am looking to find ≥ 10% I would enter .1 into the Find Field. 

When running the script, I am getting blank, with no matching records - despite the fact I know there are records higher than 10%. 

Am I doing something obvious wrong? I've also tried Find Field ≥ Percentage, but getting the same result - with no records matched. 

Thanks!

N

 

Link to comment
Share on other sites

If Find Field is a global field*, and you are trying to find records where percentage is greater than or equal to the value entered in Find Field, then you need to do:

Enter Find Mode []
Set Field [ YourTable::Percentage ; "≥" & SomeTable::Find Field ]
...

Otherwise I have no clue what you're trying to do here.

 

Note that your expression =

Percentage ≥ Find Field

is a Boolean expression; it will return a result of either 1 (true) or 0 (false).

 

---
(*) Only global fields have values in Find mode.

 

 

Link to comment
Share on other sites

Thank you. As always the advice is spot on. 

I need to learn scripting better! It was the fact that I didn't have the "" and the &.... so it worked in my mind. 

Also, correct on Global Field. I created the Field as a Global Field, for the purpose of searching only. 

Thanks as always :)

Link to comment
Share on other sites

You don't need to create global fields in that table, you can use a dedicated table just for global fields and keep your schema 'clean'.  Plus if you are capturing the user's input for what to search on, you can use variables

Link to comment
Share on other sites

You also may want to adopt a naming convention for your fields so that you can tell whether they are global or not.  That makes it easier to read your code and interpret it.  Plus your future self will thank you for it.

Link to comment
Share on other sites

This topic is 1403 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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