Show filter in a report

You customer want to show in the report all field which are used in the selection ?

There is a little piece of code for do that.

For increase the process, I say that : “If I found a hole in the fieldId number highter that 10, that’s mean that I have no more field in this layer, and I pass to the next layer”.

display FreeTxt filter()
{
    #define.RETURN          ('\n')
    #define.BEGIN           (1)
    #define.END             (60000)

    int             fieldIdx;
    int             notFind;
    int             maxNotFind  = 10;
    FreeTxt         ret;

    TableId         tableId;

    SysDictField    sysDictField;

    int newFieldIdx(int _fieldIdx)
    {
        if (_fieldIdx < 10000)
        {
            return 10000;
        }
        else if (_fieldIdx < 20000)
        {
            return 20000;
        }
        else if (_fieldIdx < 30000)
        {
            return 30000;
        }
        else if (_fieldIdx < 40000)
        {
            return 40000;
        }
        else if (_fieldIdx < 50000)
        {
            return 50000;
        }

        return 60000;
    }
    ;

    //
    //  Check for PurchLine
    //

    tableId = tableNum(PurchLine);

    for (fieldIdx = #BEGIN; fieldIdx <= #END; fieldIdx++)
    {
        sysDictField    = new SysDictField(tableId, fieldIdx);

        if (sysDictField)
        {
            notFind = 0;

            if (element.query().dataSourceTable(tableNum(PurchLine)).findRange(fieldIdx))
            {
                if (element.query().dataSourceTable(tableNum(PurchLine)).findRange(fieldIdx).value())
                {
                    ret += #RETURN;

                    ret += sysDictField.name()  + ' : ' + element.query().dataSourceTable(tableNum(PurchLine)).findRange(fieldIdx).value();
                }
            }
        }
        else
        {
            notFind ++;

            if (notFind == maxNotFind)
            {
                fieldIdx = newFieldIDx(fieldIdx);
                notFind = 0;
            }
        }
    }
}