LimeReport icon indicating copy to clipboard operation
LimeReport copied to clipboard

Signal that triggers the execution of custom getCallbackData slot is being emitted twice for each column of my data source

Open franfcunha opened this issue 4 years ago • 5 comments

Hi have defined in the report structure (using the Designer) some fields in a Data band. One example of such fields is something like: $D{DS_documentos.valor_iliquido}. Now, in the implementation of my custom slot:

` (...) case LimeReport::CallbackInfo::ColumnData:

   (...)

    if(info.columnName == QLatin1String("valor_iliquido")){
        
        data = QString::number(stru->valor_iliquido, 'f', 2);
        qDebug() << "Valor iliquido: " << data << "\n";

        // atualizar total iliq do funcionário
        _total_funcionario_valorIliquido += (multiplicador * stru->valor_iliquido);
        // atualizar total iliq acumulado
        _total_documentos_valorIliquido += ( multiplicador * stru->valor_iliquido);`

I am facing a weird behaviour: the signal that triggers the execution of my custom slot is being emitted twice for each of the columns that I have declared. This means that for a given row, the printing command that I pasted above is being executed twice.

Any idea on why is this happening? Thanks!

franfcunha avatar Nov 22 '21 12:11 franfcunha

Hi. LimeReport does not cache callback datasource data and may ask it more than once time. Is it any problem with this?

fralx avatar Nov 22 '21 16:11 fralx

I was expecting that for a given value of info.index, each columnName was"visited" only once and this is not happening in my case

franfcunha avatar Nov 22 '21 17:11 franfcunha

There are no warranties about it. If this behavior make some trouble for you, I would think about how to change it, if not, I prefer to leave it as is :)

fralx avatar Nov 22 '21 20:11 fralx

Another weird behaviour I've noted is that some columns are being ignored i.e. the value of info.columnName never reaches the name of some specific columns that I've declared inside a Group Band Footer. I've noted this in a very specific scenario: whenever the last Group Band has only one record. You can find an example that demonstrates this here (https://i.imgur.com/9jYsJJ6.png)... Please note that the line "Totais deste funcionário" marked with red corresponds to the problematic Ground Band Footer and their values copied/reused from the previous GroundBand Footer marked with green.

franfcunha avatar Dec 09 '21 16:12 franfcunha

Hi. Could you send me an example of a problematic report pattern and data?

fralx avatar Dec 10 '21 14:12 fralx