Do you need a commit step in the trigger script? I've had issues using dropdowns rather than buttons and needed to commit the change to the dropdown field to make other features work.
I just tried it now - no difference. I'm not sure what a commit step would do in this case anyway. My problem isn't with getting the pull-down field from the record - I get that OK and call the appropriate sub script to do the desired sort. Even the sort works - but the sub totals don't get displayed unless I do a pause. (I even tried doing a commit after the sort.)
It's hard to say exactly without knowing more about how you've designed your layouts and the methods you've used for producing the totals and % values.
Since pause fixes the issue, you might try replacing that pause step with a refresh window step. (Try it with and without the "Flush cached join results" option)
Hmm, it's getting even stranger. I did a refresh window (both with & without 'Flush cached join results') and it will display the sub-summary result but ONLY for the result that's in the window view at the time (i.e. if I scroll up or down, sub-summaries in those parts of the window are still not displayed).
My layout is a pretty standard one, with two summary fields in the sub-summary portion of the layout:one called 'Sub_Summary' and set to 'Total of Value' in the table definition for a (sub) summary field sorted by 'Account_Name' (ascending order), plus a second summary field called 'Percent_of_Holdings' set to 'Fraction of Total Value' in the table definition. In addition there is a 'Trailing Grand Summary' part to the layout based on a field named 'summary'. The 3 layouts in question are all defined with the same Associated Table ('Portfolio Summary) - just sorted by different fields (each sort has 2 sort fields - Account_Name and Security_Name for one; Security_Name and Account_Name for the second; and Asset_Alloc_Type and Security_ID for the third).
I have made some experimental changes to the sort (I'm losing track of what combinations I've tried!!) and have now got to the point where I get one of the two summary fields displayed consistently (the field called 'Sub_Summary' that is set to 'Total of Value') but the second one (called 'Percent_of_Holdings', set to 'ration of Total Value') is still showing a blank. But now the Grand Total is sometimes blank in one of the layouts.
Even with these changes, as I said in my original post, when the script(s) is (are) called from a button, it works consistently, e.g. the script "View Portfolio by Accounts Button" is simply:
GoTo Layout [View Portfolio by Account]
Sort (by Account_Name & Security_Name)
If I call the exact same subscript from a routine that's triggered by OnObjectModify on a field containing a pull-down list (with 'Account', 'Security', and 'Asset Allocation' as the pull-down list) with the following code, it doesn't display the % sub-summaries & inconsistently displays (or not) the Grand Total. That script is:
If [Portfolio Summary::G_View_By = "Account"]
Perform Script ["View Portfolio by Accounts Button"]
Refresh Window [Flush cached join results] (doesn't make a difference if this step is included or not, except as noted in 1st para above)
End If (and then go on to check for the other possible fields (to verify that the subsequent If statements aren't the cause, I've done this with just the one IF statement and nothing following and still get the same problem)
Sorry, " 'Percent_of_Holdings', set to 'ration of Total Value' " should read " 'Percent_of_Holdings', set to 'Fraction of Total Value' "
Is the layout where you have your button and the layout where you have the dropdown w/script trigger the same layout?
If not, do both layouts list the same table occurrence in "Show Records From" in Layout setup?
Try changing this to OnObjectExit instead of OnObjectModify. It may make no difference to the existing issue, but drop down lists permit the user to type data into the field and the OnObjectModify trigger will "fire" with every keystroke where OnObjectExit will not until you finish entering/selecting data and exit the field. (OnObjectModify is a good choice for pop up menus, radio buttons and/or check boxes.)