KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: The 4D Open APIs - Part VII: Sorting records with 4D Open (sample code)
PRODUCT: 4D | VERSION: 6.7 | PLATFORM: Mac & Win
Published On: August 24, 2001

The code below allows you to sort records.

void SortRecords(void)
{
 SortRecordPtr pSort = (SortRecordPtr) malloc(sizeof(SearchRecord));
 printf("Sorting records , field #4 in ascent order\n");
 pSort->NB_Lines = 1;
 pSort->TargetFile = 1;
 pSort->lines[0].File_Number = 1;
 pSort->lines[0].Field_Number = 4;
 pSort->lines[0].Ascent = 1;
 Check(_4D_Sort(hConnect, pSort),"_4D_Sort\0");
 free(pSort);
}