Arsip: Parameter utk report

 
user image
more 17 years ago

l1th1um

ane g bikin report. Datasetny ane bikin Query seperti ini

SELECT DISTINCT D.Tahun, D.Januari, d1.IdCustomer, d1.Nama, D2.Januari
FROM "pembayaran.DB" D, "customer.db" d1, "pemakaian.DB" D2
WHERE
(d1.IdCustomer = D.IdCustomer)
 AND (D2.IdCustomer = d1.IdCustomer) AND (D.Tahun = :thn)
ORDER BY d1.IdCustomer 
trs di form laporan nya pake 2 ComboBox - CBTahunLaporan - CBBulan Laporan di even onclick ane bkn prosedur

procedure TForm2.Button5Click(Sender: TObject);
var
begin
   DM.QReport.Close;
   DM.QReport.ParamByName('thn').AsInteger := StrToInt(CBTahunLaporan.Text);
   DM.QReport.open;
   LapBulananSQL.QRBulan.Caption := CBBulanLaporan.Text;
   LapBulananSQL.QRTahun.Caption := CBTahunLaporan.Text;
   LapBulananSQL.Preview;
end;
tapi koq yang muncul semua tahun, ga spesifik tahun dari CBTahunLaporan terus
D.Januari
mo ane bikin parameter jg. ane coba
D.:bulan
ternyata salah :D
user image
more 17 years ago

ImanD

sebelum ke report coba test dulu query secara manual sesuai dengan harapan ga?klo ngga, ditampilin di dbgrid dulu...coba test!
user image
more 17 years ago

mas_kofa

tapi koq yang muncul semua tahun, ga spesifik tahun dari CBTahunLaporan
biasanya kalo pake distinct "select distinct field1, field2,...........from....." yang tampil hanya filed pertama aja field1........... kenapa spt itu.........? ampe skrg aku belom tau jawabannya..??
user image
more 17 years ago

l1th1um

hasil query sih udah muncul, cmn pengen pake parameter. nah pas parameter itu g jalan. sy nyoba tampilin januari pake
D.Januari
nah klo diganti jadi
D.:bulan
itu jadi salah. mungkin kesalahan format, cuman g tau gmana yang benernya :D kemudian parameter tahun, even saya masukin taunny 2007, tapi 2008 juga ikut masuk k report
user image
more 17 years ago

Anonymous

SELECT DISTINCT D.Tahun, D.Januari, d1.IdCustomer, d1.Nama, D2.Januari FROM "pembayaran.DB" D INNER JOIN "customer.db" d1 ON (d1.IdCustomer = D.IdCustomer) INNER JOIN "pemakaian.DB" D2 ON (D2.IdCustomer = d1.IdCustomer) WHERE (D.Tahun = :thn) ORDER BY d1.IdCustomer silahkan di coba?!
user image
more 17 years ago

ImanD

cobain dgn ini:

procedure TForm2.Button5Click(Sender: TObject);
begin
  with DM.QReport, LapBulananSQL do
  begin
    Close;
    SQL.Text:=Format('SELECT DISTINCT D.Tahun, D.%s, d1.IdCustomer, d1.Nama, D2.Januari '+
                     'FROM "pembayaran.DB" D, "customer.db" d1, "pemakaian.DB" D2 '+
                     'WHERE (d1.IdCustomer = D.IdCustomer) AND (D2.IdCustomer = d1.IdCustomer) AND (D.Tahun=%s) '+
                     'ORDER BY d1.IdCustomer',);
    Open;
    QRBulan.Caption := CBBulanLaporan.Text;
    QRTahun.Caption := CBTahunLaporan.Text;
    Preview;
  end;  
end;
user image
more 17 years ago

l1th1um

koq ga keluar apa2 yah bos? ane coba di DataModule Masukin

  SELECT DISTINCT D.Tahun, :bulan, d1.IdCustomer, d1.Nama, :bulan2 '+
  'FROM "pembayaran.DB" D, "customer.db" d1, "pemakaian.DB" D2 '+
  'WHERE (d1.IdCustomer = D.IdCustomer) AND (D2.IdCustomer = d1.IdCustomer) AND (D.Tahun=:tahun) '+
  'ORDER BY d1.IdCustomer',);
di Event onclick ane kasih

 DM.QReport.ParamByName('bulan').AsString := concat('D:'+CBBulanLaporan.Text);
DM.QReport.ParamByName('bulan2').AsString :=concat('D:'+CBBulanLaporan.Text);
 DM.QReport.ParamByName('thn').AsInteger := StrToInt(CBTahunLaporan.Text);
di Params dah diset, bulan sama bulan2 type data string, tahun integer skrg muncul, cuman nilainya nol gmana yah ?
more ...
  • Pages:
  • 1
Share to
Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com