Sure Bob I would be more than happy to.
If @ResultSetCurrentPosition() = 1 Then { sState = State sCount = 0 NewPage(850,1100) PrintString("Number of Clients in Each State", 209, 25, 0, "Arial", 20, 0) PrintString(" ", 100, 40, 0, "", 0, 0) }
The above code runs only for the first record. It creates the page, sets a Title for the page which is 2.09 inches to the right of the edge of the paper making it centered, then creates a blank line that is used as a way to force the last y positon of the page down (explanation soon)
If State = sState Then { sCount = sCount + 1 }
If it is in the same state count it as one more from that state.
Else { WriteLN(sState + " " + sCount) PrintString(sState, 100, @PageExtentY() + 2, 40, "Arial", 15, 0) PrintString(scount, -1, -1, 0, "Arial", 15, 0) sTotal = sTotal + sCount sState = State sCount = 1 }
Runs when Sesame reaches a different state. Writes the old states name and count to the WriteLn window. Then prints the State name to the Print String page in a column that is 40/100 of an inch wide so the count all appears in one straight column, and that is 2/100 of an inch below the last state which is the last y position(@pageExtentY()). Next the code prints the count of records from that state to the Print String Page. Increases the Total by the count of Records for that State and moves on to the next State.
If @ResultSetCurrentPosition() = @ResultSetTotal() Then { WriteLN(sState + " " + sCount) PrintString(sState, 100, @PageExtentY() + 2, 40, "Arial", 15, 0) PrintString(scount, -1, -1, 0, "Arial", 15, 0) sTotal = sTotal + sCount PrintString("Total Number of Clients: " + sTotal, 100, @PageExtentY() + 10, 0, "Arial", 20, 0) FinishPage() }
This only runs for the last record it does almost the same thing as the code above except does not move on to the next state because there is not one, Adds a Grand total line to the Page below all the state information, and finishes the Print String page causing the page to print to your computer's default printer
|