May 24, 20205 yr 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
May 24, 20205 yr 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.
May 24, 20205 yr Author 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
May 24, 20205 yr 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
May 25, 20205 yr 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.
Create an account or sign in to comment