Error when force input on report

cwigintoncwiginton Member Posts: 16
I built a report using the Salesperson, Sales Line and Sales Invoice Line tables. When running the report I want the Salesperson Code and Date Filter (range) to be filled in on the Salesperson request form, in other words not blank. I added the following code to the OnPreDataItem of the Salesperson properties. Problem is I get the error when I do complete the fields on the request form. Do I need to do something to the other tables? Any help would be greatly appreciated.

SalespersonCode := Salesperson.Code;
FromDate := Salesperson.GETRANGEMIN("Date Filter");
ToDate := Salesperson.GETRANGEMAX("Date Filter");

IF (SalespersonCode = '') THEN
ERROR(TEXT003);

IF FromDate = ToDate THEN
ERROR(TEXT004);

Comments

  • garakgarak Member Posts: 3,263
    u need to get the filtervalues.
    if u use
    SalespersonCode := Salesperson.Code;
    

    then it mean, that the variable SalespersonCode gets the value of the field Code from a rec in the table salesperson.
    But u need the filter from the request form. so use:
    SalesPersoncode := SalesPerson.getfilter(Code);
    

    Regards
    Do you make it right, it works too!
  • cwigintoncwiginton Member Posts: 16
    That works perfectly!! Thank you so much!
    :D
  • garakgarak Member Posts: 3,263
    You're welcome
    Do you make it right, it works too!
Sign In or Register to comment.