Change Company Name

shivaprasad263shivaprasad263 Member Posts: 70
Hi,

In one database there are 4 companies say A,B,C and D.

I am writing processing only report to modify "customer Entry Date", which is custom field in Customer table.

I used Customer as dataitem. In the request form I have given the option to select number of companies.

CompanyFilter := A|B

In OnAfterGetRecord of the Customer Data Item , I wrote the code like

CompanyRecord.SETFILTER(Name,CompanyFilter);
If CompanyRecord.Find('-') then
SetCompany(CompanyRecord.Name);
Customer."customer Entry Date" := Workdate;
Customer.Modify;


SetCompany(NewCompany : Text[30]) //Function

Customer.CHANGECOMPANY(NewCompany);



The process what I am doing is correct ?

Comments

  • munib00munib00 Member Posts: 29
    You have to loop through the data item.
    Do something like this.

    IF Company.FIND('-') THEN
    REPEAT
    Customer.CHANGECOMPANY(Company.Name);
    IF Customer.FIND('-') THEN
    REPEAT
    Customer."customer Entry Date" := Workdate;
    Customer.Modify;
    UNTIL Customer.NEXT = 0;
    UNTIL Company NEXT = 0;
  • bbrownbbrown Member Posts: 3,268
    Abridged edition:

    IF Company.FINDSET(FALSE,FALSE) THEN
    REPEAT
    Customer.CHANGECOMPANY(Company.Name);
    {set any filters on Customer}
    Customer.MODIFYALL("customer Entry Date", Workdate);
    UNTIL Company.NEXT = 0;
    There are no bugs - only undocumented features.
Sign In or Register to comment.