Yes, read the API...Better yet, why don't we all just be nice and give 
the guy some real help...like an example?  Whadda ya say?  Eh?
This function results in items grouped by category.  You'll need your 
own sorting criteria in here

Example DmComparF function:

Int16 InventoryCompareRecords (
             void *c1,
             void *c2,
             Int16 otherinfo,
             SortRecordInfoPtr info1,
             SortRecordInfoPtr info2, MemHandle appInfoH)
{
    Int16 result;
    Int16 sortOrder;
    SentientBarcodeType sort1;
    SentientBarcodeType sort2;

    InventoryExpandRecord (c1, &sort1);
    InventoryExpandRecord (c2, &sort2);

    result = CategoryCompare (info1->attributes, info2->attributes, 
appInfoH);

    if (result == 0)
    {
        sortOrder =    InventoryGetAppSortOrder (appInfoH, 
info1->attributes & dmRecAttrCategoryMask);
        switch (sortOrder)
        {
        case SortByItemNumber:
            result = StrCompare (sort1.ItemNumber, sort2.ItemNumber);
            if (result == 0)
            {
                result = StrCompare (sort1.LotNumber, sort2.LotNumber);
                if (result == 0)
                    result = StrCompare (sort1.Description, 
sort2.Description);
                if (result == 0)
                    result = StrCompare (sort1.Transaction, 
sort2.Transaction);
            }
            break;
        case SortByDescription:
            result = StrCompare (sort1.Description, sort2.Description);
            if (result == 0)
            {
                result = StrCompare (sort1.ItemNumber, sort2.ItemNumber);
                if (result == 0)
                    result = StrCompare (sort1.LotNumber, sort2.LotNumber);
                if (result == 0)
                    result = StrCompare (sort1.Transaction, 
sort2.Transaction);
            }
            break;
        case SortByLocations:
            result = StrCompare (sort1.Location, sort2.Location);
            break;
        case SortByUserID:
            result = StrCompare (sort1.UserID, sort2.UserID);
            break;
        case SortByOrders:
            result = StrCompare (sort1.Order, sort2.Order);
            break;
        case SortByTransactions:
            result = StrCompare (sort1.Transaction, sort2.Transaction);
        }
    }
    return result;
}


Scott Johnson wrote:

>>From: Atul Shingade [mailto:[EMAIL PROTECTED]]
>>I am using DmQuickSort Function but I dont know
>>how should I use DmCompareF call back function.
>>
>
>DmComparF is not a function, but rather is a typedef for a certain type of
>function.  You need to write a function yourself that matches the function
>signature in that typedef.  You'll write this "callback" function but never
>actually call it.  You just pass the callback function's address to the
>system in the DmQuickSort call, and then the system will call it
>automatically several times during the sort, as needed.
>
>This callback function has to simply compare two records and return a result
>saying if they are equal, or which one is greater.  Since you want
>alphabetical order, your callback will probably involve StrCompare or
>similar logic.  This whole callback mechanism is used because the system has
>no idea of the internal format of your database records.  So the system asks
>you to help it out with your own custom function that does know the format
>and how to compare them.
>
>The API documentation covers the details...
>
>-slj-
>
>
>

-- 
James Barwick
Sentient Health Japan KK




-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to