Logic: DeviceSearchList

If the user presses the "Index" button on the "DeviceSearch" screen, we want to get all Device entries from the database and place them in a List Store, so they can be presented in the List View.

CLEAR LISTSTORE Device

CLEAR DATAMODEL Device
DATAMODEL SELECT DeviceSearch TABLE Device
IF SQLSTATUS() <> 0
	RETURN
ENDIF

FOREACH DeviceSearch
	LIST APPEND Device VALUE CLIP(M-deviceNumber.DeviceSearch) CLIP(M-description.DeviceSearch)
ENDFOR

DISPLAY DeviceSearchList

We first clear the List Store from any data if any, execute a DATAMODEL statement to retrieve the data and append all values to the List Store. The built-in function CLIP, clips leading and trailing spaces from a data reference.