Search code examples
delphiqr-codereportbuilderbarcode-printing

Generate QrCode on ReportBuilder with multiple rows of data


So here's whats happening

Im working with 2dDBbarCode on ReportBuilder (Digital Metaphors) to generate a QrCode that encode all itens (products) in the report, one item per row. But it only encode the first row of data. The 2dDBbarcode is positioned on Report's Header band.

How can i have multiple rows of data inside 2dBDbarcode?

I've already take a look at rbuilder guide at http://www.digital-metaphors.com/pdf/rbuilder.pdf but cant get nothing from there


Solution

  • I actually found a way to get around this problem. instead of create a report pipeline to get data from database directly inside 2dbarcode, I'm passing the data before open up report. The code now is:

            with DataModule2.Sql_IdQtd1 do
              begin
                Close;
                SQL.Clear;
                Sql.Add('select concat("when ",id_produto," then ",quant) from mv_vendas_movimento');
                Sql.Add('where controle=:NumPed');
                ParamByName('NumPed').Value := NumPed;
                ExecSQL;
            Open;
            First;
    
    -- here it goes thru each row of data and store it to 2dbarcode.data, one row by line 
    
             DataModule2.p2dbrcd1.Data := 'UPDATE cad_produtos SET estoque = estoque + CASE id';
                while (not Eof) do begin
                  DataModule2.p2dbrcd1.Data := DataModule2.p2dbrcd1.Data +sLineBreak+ DataModule2.Sql_IdQtd1concatwhenid_produtothenquant.Text;
                  Next;
                end;
                DataModule2.p2dbrcd1.Data := DataModule2.p2dbrcd1.Data +sLineBreak+ 'ELSE estoque END'
    
              end;