Sort An Array Using Datastore In PowerBuilder
We create a small datastore and use it to sort our array.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
datastore lds_temp String ls_err Integer i Long ll_array[] = { 2 , 3, 6, 5 } String ls_dsdef = 'release 6; datawindow() table(column=(type=long name=a dbname="a") )' lds_temp = Create datastore lds_temp.Create(ls_dsdef, ls_err) // put the array in the datastore lds_temp.Object.a.current = ll_array lds_temp.SetSort("a ASC") lds_temp.Sort() // get back the array ll_array = lds_temp.Object.a.current For i = 1 To UpperBound(ll_array) MessageBox("Infor", String(ll_array[i])) Next Destroy lds_temp |
Good Luck!
Subscribe
Login
0 Comments
Oldest