Páginas

sábado, 4 de outubro de 2014

Tabelas Filtros HFilter

Tabelas Filtros HFilter




C:\WinDev 19\Examples\Training\WD Search On Composite Keys\Exe

// Change the search key to display the table
// Display the entire table in order to take the filter into account.
// Cancel the previous filter
HDeactivateFilter(ORDERS)
SWITCH SELECT_FILTER
    CASE 1 : // NAME + DATE
        TABLE..BrowsedItem = ORDERS.NAMEDATE..Name
    CASE 2 : // DATE + NAME
        TABLE..BrowsedItem = ORDERS.DATENAME..Name
        IF NoSpace(MINDATE)<>"" AND NoSpace(MAXDATE)<>"" THEN
            // New filter on DATE.
            // Used to sort on DATE and NAME
            // Adding de hMinVal and hMaxVal to the bounds is used to get the sorted records when the 2 bounds are identical (same dates)
            HFilter(ORDERS, TABLE..BrowsedItem, [MINDATE, hMinVal], [MAXDATE, hMaxVal])
        ELSE
            IF MINDATE~="" THEN
                Info("Specify a start date")
                ReturnToCapture(MINDATE)
            END
            IF MAXDATE~="" THEN
                Info("Specify an end date")
                ReturnToCapture(MAXDATE)
            END
        END
    CASE 3 : // Automatic identifier + Date
        TABLE..BrowsedItem = ORDERS.CUSTDATEID..Name
        HFilter(ORDERS, TABLE..BrowsedItem, [MINCUSTOMERID, hMinVal], [MAXCUSTOMERID, hMaxVal])
    CASE 4 : // DATE + Code + NAME
        TABLE..BrowsedItem = ORDERS.DATECODENAME..Name
        // check the bounds before implementing the filter
        IF DateValid(MINDATE) _AND_ DateValid(MAXDATE) _AND_ MINCODE<>0 _AND_ MINCODE<>0 THEN
            HFilter(ORDERS, TABLE..BrowsedItem, [MINDATE, MINCODE], [MAXDATE, MAXCODE])
        ELSE
            Error("Specify:")
        END
END
// Display the entire table in order to take the filter into account.
TableDisplay(TABLE, taStart)



Nenhum comentário:

Postar um comentário