View Single Post
Originally Posted by imlad View Post
I would like to see not only the fact that there was at least one check, but how many there were
It would be worth requesting a 'numeric' summary type for checkbox columns through Help > Send Feedback in the OO3 menu.

In the meanwhile, as you suggest, only a numeric column (using digits in lieu of checkboxes) will give you an automatic numeric summary.

If you really want to use check-boxes you could install a script on your 003 toolbar to update numeric counts of checkboxes in an adjacent numeric column, but you would have to click the script every time you wanted to update the numbers - probably not ideal ...

(Such a script might look something like the following)

property pstrSummaryCol : "CheckSums"

tell application "OmniOutliner Professional"
	set oDoc to front document
	tell oDoc
		-- Get a reference to the first checkbox column
		set colCheck to first column whose type is checkbox
		if colCheck is missing value then return
		set idCheck to id of colCheck
		-- Get a reference to a CheckSums column (creating it if necessary)
		set refCols to a reference to columns
		if not (name of (refCols) contains pstrSummaryCol) then 
			set oCol to make new column at end of columns with properties {name:pstrSummaryCol, type:number}
		set oCol to first column whose name is pstrSummaryCol
		set format string of oCol to "0"
		set idSum to id of oCol
		-- Count checked boxes and update the sums for each parent row
		set lstTopParents to (rows of oDoc where (level is 1) and has subtopics is true)
		repeat with oRow in lstTopParents
			my CountChecks(oRow, idCheck, idSum)
		end repeat
	end tell
end tell

-- Count the checks, and write (sub)totals to the CheckSums column of any parent rows
on CountChecks(oRow, idCheck, idSum)
	using terms from application "OmniOutliner Professional"
		tell oRow
			if has subtopics then
				set lngChecks to 0
				repeat with oSubTopic in children
					set lngChecks to lngChecks + (my CountChecks(oSubTopic, idCheck, idSum))
				end repeat
				set value of (cell id idSum) to lngChecks
				if (value of cell id idCheck) is "checked" then
				end if
			end if
		end tell
	end using terms from
end CountChecks

Last edited by RobTrew; 2010-06-26 at 03:02 PM..