Options

clear a picture

Chris_SharmanChris_Sharman Member Posts: 2
I've used the following code in a report to get company details for a letterhead (we send letters on behalf of our customers). Unfortunately, where there isn't a logo on file, I just get the preceding one. So when a letter for a company with no logo is required, the preceding company's logo is left lying around and is incorrectly used - this happens when companycontact.get returns false, and we init the companycontact and use customer details instead - seems like init doesn't clear out the old picture.

I've two report sections, which either print the logo, or the name, on the basis of Picture.HASVALUE

Can anyone suggest please the right way to clear the unwanted previous picture ?

IF NOT CompanyContact.GET("Company No.") THEN BEGIN
CompanyContact.RESET;
CompanyContact.INIT;
IF Customer.GET("Company No.") THEN BEGIN
CompanyContact."Home Page" := Customer."Home Page";
CompanyContact."E-Mail" := Customer."E-Mail";
CompanyContact."Phone No." := Customer."Phone No.";
CompanyContact.Name := Customer.Name;
END;
END;
// appears to not work well - missing pictures just print preceding.
CompanyContact.CALCFIELDS(Picture);
Thanks,
Chris

Comments

  • Options
    SteveOSteveO Member Posts: 164
    Try using CLEAR instead of RESET and INIT.

    RESET doesn't clear the field values only filters and secondary keys etc.

    INIT doesn't clear the value of the Primary Key fields.
    This isn't a signature, I type this at the bottom of every message
Sign In or Register to comment.