Add customer Phone Number in Report

RMolenaarRMolenaar Member Posts: 94
edited 2015-04-17 in NAV Three Tier
Hello,

First of all I want to say I am not very familiar with Reports in NAV. Only very basic knowledge.
I want to change a Report in Visual Studio. I want to add a Customer Phone No.
Must be very simple I would say :shock:

I added a DataItem "Customer" with a link to Sales Header and a column with Customer."Phone No." (image1)
After that I started Visual Studio and added a field with Expression =Fields!PhoneNo_Customer.Value (image2)

Back to Development enviroment and Compiled.

When I run the Report a lot is missing on the Report (image3)

Could you please help me a bit further in the right direction?

Thank you
Microsoft Dynamics NAV 2013 R2
NAV 7.1

Comments

  • Bogdan_UABogdan_UA Member Posts: 15
    Hi Molenaar,

    You can get Customer record variable in the "Sales Header - OnAfterGetRecord()" trigger. Also add in the Report Dataset new column with Customer."No." data source. (Can be add to the <Sales Header> or <PageLoop> Data Item). And don't create new DataItem for the Customer.

    In the Visual Studio Layout use GetData and SetData functions for value output.
    You can look this How Do I video: https://www.youtube.com/watch?v=dievcKyhoWU

    Best Regards,
    Bogdan
  • RMolenaarRMolenaar Member Posts: 94
    Hello Bogdan,

    I really appreciate your help. I only had a basic Report training without C/AL codes.
    Could you tell me how to add the trigger in the Sales Header - OnAfterGetRecord()?
    I think it will be the .GET function?

    Thanks again.
    Microsoft Dynamics NAV 2013 R2
    NAV 7.1
  • Bogdan_UABogdan_UA Member Posts: 15
    Hi Molenaar,

    Yes it will be .GET function:
    Customer.GET("Sales Header"."Sell-to Customer No."); or Customer.GET("Sales Header"."Bill-to Customer No.");
  • RMolenaarRMolenaar Member Posts: 94
    Thank you Bogdan!. I know how to add a field into the report and works great, however...
    When I Preview the report the field is shown OK but when I print the report the field is not printed?

    Another question:
    Is is possible to add the Telephonenumber in the CustAddr?
    When I put my Expr. field below the CustAddr fields in the report I will have some white spaces. (image4)

    Best Regards,
    Rob
    Microsoft Dynamics NAV 2013 R2
    NAV 7.1
  • sorenhinrupsorenhinrup Member Posts: 136
    To remove the empty values - you can use the funtction COMPRESSARRAY.
    Ex:
    COMPRESSARRAY(CustAddr);
  • Bogdan_UABogdan_UA Member Posts: 15
    Could you show Expression of TextBox where you output the customer number, and also field position?
  • RMolenaarRMolenaar Member Posts: 94
    Hi,

    I solved the problem of showing the PhoneNo when printing.

    Thanks
    Microsoft Dynamics NAV 2013 R2
    NAV 7.1
Sign In or Register to comment.