Options

Navision 4.Dynamic picture in report

delaghettodelaghetto Member Posts: 89
Hi

I don't know if I can achieve this in Navision 4 sp3.

I've got a report that shows a picture that is stored in a BLOB type field of a table.

The thing is that this company prints 2 type of checks, and both are the same. The only thing that changes is the background image.

So in the sourceexpr for the picture control field I've got my BLOB type field: BankAcc2.Picture

I've create BannkAcc2.Picture2

I see I can't define a BLOB type Global Variable. I need to dynamically change the SourceExpr of the control. something like If CheckType = 1 then SourceExpr = BannkAcc2.Picture2 else BannkAcc2.Picture

Any ideas?

Comments

  • Options
    geordiegeordie Member Posts: 655
    You can define two sections with the same controls (but different images) and manage their visibility through CurrReport.SHOWOUTPUT statement.
  • Options
    delaghettodelaghetto Member Posts: 89
    Thanks for the answer.

    I tried this approach of having two sections.

    The thing is that the section is the report footer. So now I have two footers. The property PrintOneverypage is set to No, and PlaceInbottom is Yes.

    The problem is that now even when I don't print one of the footers, it's like if the space occupied by it is "consumed" by the hidden footer, so there is a big white gap in the report.

    How can I avoid this??
  • Options
    geordiegeordie Member Posts: 655
    Is the CurrReport.SHOWOUTPUT placed in OnPreSection trigger? Doing in this way you should be able to avoid the problem.
  • Options
    delaghettodelaghetto Member Posts: 89
    Yes, it's in the OnPreSection before all the other calculations.
  • Options
    vaprogvaprog Member Posts: 1,125
    delaghetto wrote:
    I see I can't define a BLOB type Global Variable.
    Define a Record variable instead, with any subtype that contains a blob field. Then after you have executed CALCFIELDS on the original blob field, you can assign it to your variable and use that as source expression.
    CompanyInfo.GET;
    IF SomeCondition THEN BEGIN
      CompanyInfo.CALCFIELDS(Picture)
      TempBlob.Blob := CompanyInfo.Picture;
    END ELSE BEGIN
      CompanyInfo.CALCFIELDS("Picture 2");
      TempBlob.Blob := CompanyInfo."Picture 2";
    END;
    
    // use TempBlob.Blob as SourceExpression of your Picture Box
    
  • Options
    delaghettodelaghetto Member Posts: 89
    vaprog wrote:
    Define a Record variable instead

    Thanks for posting. Actually I thought of that solution after posting. But the problem is that now I need to take 2 section approach, because apart from the Picture, also other fields are going to be different in each footer section.

    I think anyway the problem is with NAV 4 SP2. It seems like sp2 version "reserves" space for all footers, even when not displayed. I'm going to try and migrate to SP3 at least.

    Or otherways I will create 2 different reports and get it done #-o

    Thanks for helping guys!
Sign In or Register to comment.