The Field_GetVisualPosFromInsertPos() function retrieves the visual position of an item in a list field (list box, drop-down list, button drop list, or visual switch) based on its insertion position.


Field_GetVisualPosFromInsertPos(list_field, insert_pos)

list_field – The list field for which information is being retrieved.

insert_pos – An integer specifying the insertion position of the item for which the visual position is being returned. The value 1 indicates the first item that was added to the list.

Return value

An integer containing the visual position of the item.


When static items are added to list fields, either in the data type definition or with sanScript, they are added in insertion order. The value of the list field is based on the insertion position of the item selected. If the list is sorted, the visual order of the items may be different than the insertion order. If you know the insertion position of an item, use this function to retrieve the item’s visual position.

If you are using the add item statement to add items to a list field, be sure to use the redraw statement to resort the items before using the Field_GetVisualPosFromInsertPos() function.

Documentation Feedback