Filtered Grid (Dynamically)

Hello…
I need, in a grid, generate a filter with a button or checkbox, to select the filter criteria to show records.
When check or uncheck the checkbox, or push a button, the filter change, and the data are refresh…
I’m not found a sample…
Some can help me?
Thanks…

SOLVED!!!

  • Add two global variables, in the first app
    $ModoFiltroClientes = 0;
    sc_set_global($ModoFiltroClientes);
    $FiltroClientes = ‘CLI.Inactivo = 0’;
    sc_set_global($FiltroClientes);

  • Create a control app, whit a radio, whith the filter (3 options, only active, all, only inactives, 0,1 and 2, repespectly).
    This variable (local) save in [ModoFiltroClientes]

  • In the grid app, in the SQL sentence, put Where [FiltroClientes]

  • In the grid app. add in scriptInit, to set the filter
    switch ([ModoFiltroClientes]) {
    case 0:
    [FiltroClientes] = “CLI.Inactivo = 0”;
    break;
    case 1:
    [FiltroClientes] = “CLI.Inactivo < 2”;
    break;
    case 2:
    [FiltroClientes] = “CLI.Inactivo = 1”;
    break;
    }

  • In the grid app, add a Button “Filter”, link to the control app, in the same window,

Compile, run… and work!!

On your first app instead

$ModoFiltroClientes = 0;
sc_set_global($ModoFiltroClientes);
$FiltroClientes = 'CLI.Inactivo = 0';
sc_set_global($FiltroClientes);

Do

[ModoFiltroClientes] = 0;
[FiltroClientes] = 'CLI.Inactivo = 0';

And set this globals as out.
sc_set_global is a deprecated function.