3.1.1.4.2 Fractional Positioning

The second form of specifying position in a STAT structure–based table is called Fractional Positioning. The client specifies this type of positioning by setting the field CurrentRec to the value MID_CURRENT. Fractional positioning is defined as only an approximation in the NSPI Protocol. The server MAY<11> be inaccurate both in locating a row based on fractional positioning and in reporting the resultant actual fractional position. The server uses the following steps to identify the Current Position specified by the client:

  1. First, the server identifies the LCID it supports that is closest to the LCID specified by the SortLocale field. The server MAY<12> choose this closest LCID in any way.

  2. The server sorts the objects in the address book container specified by the ContainerID field by the sort type specified in the SortType field and the LCID identified in step 1.

  3. The server identifies the number of objects in the sorted table. The server reports this in the TotalRecs field of the STAT structure.

  4. The server calculates the Intended Numeric Position in the table as the TotalRecs multiplied by the NumPos field of the STAT structure divided by the value of TotalRecs as specified by the client. The value is truncated to its integral part.

  5. If the Intended Numeric Position thus calculated is greater than TotalRecs, the intended Intended Numeric Position is TotalRecs (that is, the last row in the table).

  6. Once the server has identified the Intended Numeric Position, the server sets Numeric Position to an approximation of that value. Although the protocol places no boundary or requirements on the accuracy of the approximation the server uses to set the Numeric Position, it is recommended that implementations maximize accuracy of the approximation to improve usability of the NSPI server for clients.

  7. The server moves the Current Position to the row chosen in step 6.

  8. The server moves the Current Position by the number of rows specified by the absolute value of the Delta field of the STAT structure. If the value of Delta is negative, the Current Position is moved toward the beginning of the table. If the value of Delta is positive, the Current Position is moved toward the end of the table. A Delta field with the value 0 results in no change to the Current Position.

  9. If applying the Delta as described in step 8 would move the Current Position to be before the beginning of the table, the server sets the Current Position to the beginning of the table and sets the CurrentRec field to the MId of the object occupying the first row of the table.

  10. If applying Delta as described in step 8 would move the Current Position to be after the end of the table, the server sets the Current Position to a location one row past the last valid row of the table and sets the CurrentRec to the value MID_END_OF_TABLE.

  11. The server sets the field CurrentRec to the MId of the object occupying the row specified by the Current Position.

  12. The server identifies the numeric row of the Current Position in the sorted table. This numeric row is 0-based. That is, the first valid row in the table has the numeric position 0. This is the Numeric Position of the Current Position of the table. The server reports this in the NumPos field of the STAT structure.

Show: