Options

Processing Only Report to Assign Customer to a Salesperson

emulsifiedemulsified Member Posts: 139
I have a processing only report right now that I want to run.
It should assign any customers with "VIDEO DILEMA" in the Customer.Name field to Customer."Salesperson Code" := 'ANN'

For example I want to apply a filter to Customer.Name like VIDEO DILEMA* because some of the accounts have different store numbers after their names.
Then I want to do a Customer."Salesperson Code" := 'ANN'
Then I do a Customer.MODIFY to save the changes and move on.

My question is how do I get just the group of Customers with their Name like VIDEO DILEMA* ?

Here is my code from my processing only report from Customer - OnAfterGetRecord() section:

REPEAT
IF Customer.Name = 'VIDEO DILEMA*' THEN BEGIN
Customer."Salesperson Code" := 'ANN';
Customer.MODIFY;
END;
UNTIL Customer.NEXT = 0;


I'm pretty sure I need to do something like this:

SETFILTER() or something

REPEAT
Customer."Salesperson Code" := 'ANN';
Customer.MODIFY;
UNTIL Customer.NEXT = 0;


I think I'm on the right track here can someone help me out? It's been a while since I wrote one of these. What should SETFILTER look like, where should it be placed? OnPreDataItem(), OnAfterGetRecord(), OnPostDataItem, or somewhere else?

I know it's pretty simple but my mind is clouded at the moment. Thanks.
Half-empy or half-full how do you view your database?

Thanks.

Answers

  • Options
    matttraxmatttrax Member Posts: 2,309
    OnPreDataItem - Because you want to filter before you begin processing.

    SETFILTER(Name, '@*Name*') will find anything with Name in it (the *s) and ignore capitalization (the @).
  • Options
    SavatageSavatage Member Posts: 7,142
    If the dataitem is customer then all you need
    OnAfterGetRecord()
    "Salesperson Code" := 'ANN';
    MODIFY;

    Then run the report you will see the Reqeust Filter Fields

    Add Name :VIDEO DILEMA*

    Or you can run the customer table from Object Designer
    Filter On Name VIDEO DILEMA*
    Goto the salesperson column type in ANN & F8 all the way down
  • Options
    emulsifiedemulsified Member Posts: 139
    Thanks Harry.
    Half-empy or half-full how do you view your database?

    Thanks.
Sign In or Register to comment.