Hi
I need a steer on how I'd do the following:
I have a report where I wish to give the user a means of running the report by entering 1 of 3 variables - to either enter a PO number or Item Code or Item Description.
I would like them to be able only to enter one of these parameters.
I've created the following report which works but doesn't block them entering more than one parameter.
select 'dbr.parameters.show';
select 'dbr.css','.row_header .report_params_header_row {display:none;}';
select 'dbr.calc','[LTotal]','([rQty]*[Price])/[Rate]'; select 'dbr.calc','[GBPCost]','([Price])/[Rate]'; select 'dbr.colstyle','Price','%0.5f'; select 'dbr.colstyle','Rate','%0.5f'; select 'dbr.colstyle','LTotal','%0.5f'; select 'dbr.colstyle','GBPCost','%0.5f';
select b.PONumber as "PO Number[PONum]", c.SuppName as "Supplier[Supp]", date_format(b.OrderDate,"%d/%m/%Y") as "Order Date", a.ItemCode as "Item Code[iCode]", a.Description as "Description[Desc]", f.GRN as "Batch #[Batch]", a.QtyOrdered as "Qty Ordered[oQTY]", a.QtyRec as "Qty Received[rQty]", a.Price as "Unit Price[Price]", (case c.Currency when "Euro" then "Euro" when "US Dollar" then "USD" when "Yen" then "Yen" when "CHF" then "CHF" else "GBP" end) as "Curr.[Cur]", ifnull(d.Rate,1) as "Rate[Rate]", null as "£ Cost[GBPCost]", null as "Item Total[LTotal]" from podetails a left outer join poheader b on a.PONumber = b.PONumber left outer join supplier c on b.Supplier = c.`SageCode` left outer join tblcurxref e on c.Currency = e.PCurrency left outer join tblcurrency d on e.Currency = d.Currency and Year(d.CDate) = Year(b.OrderDate) and Month(d.CDate) = month(b.OrderDate) left outer join goodsinaudit f on a.PONumber = f.POnumber and a.ItemCode = f.ItemCode
where (case when length(inPO) >0 then a.PONumber = inPO when length(inItemC) >0 then a.ItemCode = inItemC else a.Description = inItemD end) and a.QtyRec > 0 order by b.OrderDate desc;
As you can see I'm checking to see if any of the parameters have been entered by checking their length. It works but I don't think it's the best way to do this.
Any help most appreciated.
Cheers
Jake