I have successfully created a custom dialog box which uses an array to read in a list of developer names from a table, and populates the selected record based on the row number pulled in from the developer table.
Table is Developer ID Developer Name 1 A developer 2 B developer 3 C developer 4 D Developer 5 AAA Developer 6 C2 developer
I have also had success in then populating the selected value from the popup menu back to the table. At present the developer list contains about 400 names. As new names are found, they need to be added to the table. In above example- ID 1 to 4 were added initially then 5 and 6 later and they aren't sorted alphabetically.
My question is does anyone know if there any way that I can I get the table from the array in alphabetical order without upsetting the row numbers from the developer table? If I add say another 50 developers to the bottom of the table then it becomes hard to find them as they are not sorted alphabetically - whilst the first 400 I put in are.
Given that the popup menu reads in the row number and assigns this to the value in the popup menu then writes it based on the value selected in the popup, I am unsure whether this can be done.
iRows1 = TableInfo(developer, TAB_INFO_NROWS) 'redim developername array based on number of rows in table ReDim sDeveloperName1(iRows1) For iLoop1 = 1 to iRows1 Fetch rec iLoop1 from developer sDeveloperName1(iLoop1) = developer.developername Next 'Developer details groupbox control groupbox title "Developer Details" Position 5,206 width 130 height 97 control statictext position 10,216 title "Primary developer" control popupmenu position 10,228 width 120 ID 20 Title from Variable sDeveloperName1 into iDeveloperID1out Sub ReadIn_PopUpMenu_Items 'converts table value into the popupmenu item for primary developer listed dim developerID1temp as integer developerID1temp=selection.developerID1 if developerID1temp=0 then alter control 20 value 1 Else alter control 20 value developerID1temp End if End 'if 1st value in popup menu is selected then developer is unknown so write the 'value back to the selected record as 0 If iDeveloperID1out=1 then Update Selection set col20=0 else Update Selection set col20=iDeveloperID1out End If