Jump to content


  • Content Count

  • Joined

  • Days Won


comment last won the day on October 13

comment had the most liked content!

Community Reputation

1,579 Excellent

About comment

  • Rank

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Once you have looked up the factor into a local field, it's just ProductCost * Factor.
  2. Actually, it's not as basic as it would seem. There are several ways you could look at this. But first, let's understand the exact situation you're tracking: Can a unit ever have more than two employees? Can an employee belong to more than one unit? (Even if not, would you want to keep a history of employee's membership in a unit, in case they're reassigned?)
  3. Assuming "highlighted" mean selected, make your button insert a calculated result = TextStyleAdd ( Middle ( Get ( ActiveFieldContents ) ; Get ( ActiveSelectionStart ) ; Get ( ActiveSelectionSize ) ) ; Strikethrough ) Same thing - just use the TextColor() function instead. Do note that this may exhibit some quirky behavior when the text already has some styling at the insertion point. I prefer to remain clothed.
  4. Here is a guess: The field EventNo is not actually present on your layout. You have only added it to Table view using the Modify Table View dialog.
  5. I cannot reproduce the problem using your description. See if the attached file works for you. Test.fmp12
  6. Did you enable "Use advanced tools" in the application's Preferences? Do you have full access privileges to the file?
  7. First thing: a field formatted as a checkbox set should be defined as a Text field, not a Number field. As you have correctly observed, the field contains a return-delimited list of selected values. Now, to add a new item to such field, you can do: Set Field ( YourTable::YourField ; List ( YourTable::YourField ; "new item" ) (Note that this assumes the item is not already checked - otherwise it will be duplicated.) I am afraid I don't follow this part. If setting the field to the text string "1¶2¶3" does not result in 3 checkboxes being crossed, then your value list is defined to use other values - hard to tell from your screenshot.
  8. I said "otherwise" - i.e. when the user does not need to interact with the process.
  9. If you just want a quick calculator, you could do a simple Case() statement along the lines of: Case ( Price > 1500000 ; ( Price - 1500000 ) * .12 + 93750 ; Price > 925000 ; ( Price - 925000 ) * .10 + 36250 ; Price > 250000 ; ( Price - 250000 ) * .05 + 2500 ; Price > 125000 ; ( Price - 125000 ) * .02 ) (the above is based on the example here.) Or, to simulate what your Excel formula does: Sum ( If ( Price > 125000 ; ( Price - 125000 ) * .02 ) ; If ( Price > 250000 ; ( Price - 250000 ) * .03 ) ; If ( Price > 925000 ; ( Price - 925000 ) * .05 ) ; If ( Price > 1500000 ; ( Price - 1500000 ) * .02 ) ) However, it is not good practice to hard-code tax brackets and rates into a calculation formula, as these will change over time. A better solution would store the current brackets and rates in a preferences table or a table of their own, and lookup from there. Please update your profile to reflect your version and OS, so that we know what you can use.
  10. Yes. That is the default. This is assuming that the user needs to interact with the other layout. Otherwise you can have your script freeze the window, open a new one (either on top or off-screen), do its thing and return - and the user will not notice anything (at least not on a Mac).
  11. If you want to perform calculations that will be used in a sub-summary part, you need to use the GetSummary() function.
  12. OnPanelSwitch is relevant, GetLayoutObjectAttribute is not. Simply make the triggered script remember the target panel using the Get ( TriggerTargetPanel ) function. Of course, all this can be avoided if you open a new window, do whatever you need to do, then close the window to return to your previous state intact.
  13. Well, I think it would be sufficient to note that this solution assumes that the "blacklist" does not contain duplicate values. Then, if a reader that wishes to implement this deals with a scenario where this is not the case, they need to ask how to remove duplicates from their list before using it here. This is a completely separate problem, that has nothing to do with the question being discussed here. This, BTW, is a major issue with so many custom functions published in the community: they come to solve one problem and end up struggling with assorted side issues that only obfuscate the solution. For example: if your function expects a number as its input, say so - and don't do GetAsNumber ( input ) "just in case". -- P.S. It might also be worth noting that the above solution is based on the observation that UniqueValues() leaves the first value in place and removes any subsequent duplicates. And that since this behavior is undocumented, it could change in future versions without notice.
  • Create New...

Important Information

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