'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Script Name: Exam.BelowMean ' Script description: accesses the active view and theme by position, prompts user ' for a numeric field in the FTab of the theme, then runs a query to highlight CSDs ' in the theme below the mean for a chosen field. ' ' Usage: as menu item on view menu ' Author: Tom Kralidis ' Created: 19-Oct-1999 ' Changes: ' ' Author Date Changes ' T. Kralidis 19-Oct-1999 Initial Implementation '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' open active window myProj = av.GetProject myView = av.GetActiveDoc myViewWin = myView.GetWin myViewWin.Open ' open active theme myTheme = myView.GetActiveThemes.Get(0) myTheme = myView.GetThemes.Get(0) myTheme.SetVisible(True) ' user selection dialog ' display fields from joined table valFTab = myView.GetThemes.Get(0).GetFTab myFieldList = valFTab.GetFields myField = MsgBox.ListAsString(myFieldList,"Field Selection","Choose Numeric Field") myFTab = myView.GetThemes.Get(0).GetFTab theBitmap = myFTab.GetSelection theBitMap.ClearAll ' record manipulation from chosen field ' calculate average valSum = 0 valCount = 0 valList = List.Make For each record in valFTab myVal= myFTab.ReturnValue(myField,record) valList.Add(myVal) valSum = valSum + myVal valCount = valCount + 1 end valAverage = valSum / valCount myOperator = "<" ' run query and update display theQuery = "[" + myField.AsString + "]" + myOperator + valAverage.AsString myFTab.Query(theQuery,theBitmap,#VTAB_SELTYPE_NEW) myFTab.UpdateSelection ' display validation message box of user entered-field and average calculated MsgBox.Info(" Field chosen:" ++ myField.AsString ++ NL ++"Mean: " ++ valAverage.AsString,"Output")