REPORTS

Create a simple report for customer list. The report should be in landscape with 15 or more columns. In the options tab, there should be 5 checkboxes indicating any 5 columns. If I select those checkboxes then they should not be printed and the columns should be moved. We are talking about moving of columns on the fly. can any one explain me how to create a report...and where should we write code..?

Best Answers

  • TallyHoTallyHo Member Posts: 416
    Answer ✓
    Hi.

    This is about the classic client right?
    It has no columns, only sections.
    They can be hidden using currreport.showoutput onpresection,
    but with the requirements you mention this wil take some effort.

Answers

  • RockWithNAVRockWithNAV Member Posts: 1,139
    I believe this is very simple to achieve. Make your report with your given requirement. Once you are done with thee requirement add all flags whatever needed and then put a visibility condition on each columns wherever needed.
  • dynamics navdynamics nav Member Posts: 50
    I created a report with all the requirements given..but after preview there is an empty space where we are hiding..but my condition is that when we preview the report there should not be any empty space all the columns should move..
  • RockWithNAVRockWithNAV Member Posts: 1,139
    Do u have applied a visibility condition??
    If you have applied filter or something then it will show blank space but not if visibility condition is there and still if its showing then theirs a different case altogether.
  • TallyHoTallyHo Member Posts: 416
    Answer ✓
    Hi.

    This is about the classic client right?
    It has no columns, only sections.
    They can be hidden using currreport.showoutput onpresection,
    but with the requirements you mention this wil take some effort.
  • dynamics navdynamics nav Member Posts: 50
    It is classic client...I wrote currreport.showoutput(NOT Hidecity) in body section of customer data item and in another body section I wrote currreport.showoutput(Hidecity)..I declare hidecity as global variable with boolean data type...I wrote for customer dataitem onaftergetrecord trigger as:

    IF NOT HideCity THEN
    FormatAddr.Customer(CustCity,Customer);

    it is not working...
  • TallyHoTallyHo Member Posts: 416
    edited 2016-08-17
    Make sure you put it in the OnPreSection trigger of the body.
    This should thrigger what section is shown.
    You'll have to make multiple sections to get the desired result (one for each possible Boolean combination)..

    Another way to approach this is to manipulate the CustCity Array after filling it with formataddr.
    So, if you want to leave out city, then you should clear this from the array
    f.i. clear(CustCity[6]). And after that compress the array.
    This way it can probably all be done in one body section, and no showoutput code is needed.


  • dynamics navdynamics nav Member Posts: 50
    edited 2016-08-18
    can you explain me how to hide the header part in reports using nav 2009 r2 classic client.. and also explain me how to move the columns if there are hiding..?
  • TallyHoTallyHo Member Posts: 416
    edited 2016-08-19
    In Report 6 Trial Balance you can see how to hide the header part of a report in a classic report.
    You cannot hide controls/fields (not colums).
    You need to have put them on a section that is not hiding, in a way that if one section is showing the other one is hiding. You need to do this with a few more sections. Only one should be showing containing all the data that is needed in that particular combination of Boolean settings.

    Please try my other approach too. With arrays you kan fill the controls flexible, and there is probably no need anymore to hide any sections.
  • dynamics navdynamics nav Member Posts: 50
    I tried the concept of report 119 in classic client the data in the columns was hiding but the columns are not moving..? can u explain how to move columns left...
  • TallyHoTallyHo Member Posts: 416
    edited 2016-08-19
    I will try to.. I'll use the array option.
    In report 119 CustAddr array is used in the second 'column', as you call it, in customer body(7).
    The CustAddr Array has 8 Dimensions.
    Adjust this to 24 in the C/AL globals properties.
    Create ArrayOf8 global with the same text properties, exept give it 8 dimensions.

    Now delete the controls that contain
    "No.", "VAT Registration No." and AmtSalesLCY from customer body(7)

    Select and Copy all the controls in the column and paste them to the right of this column. Paste them again to the right of the pasted column So now you have 3 columns.

    Column 1 contains CustAddr[1]..CustAddr[8].
    Adjust the arrays in column 2 so that they contain CustAddr[9]..CustAddr[16]
    Adjust the arrays in column 3 so that they contain CustAddr[17]..CustAddr[24].

    After that write C/AL code in customer/OnAfterGetRecord to move your data through your columns by setting one of three booleans:


    //IF NOT HideAddress THEN
    // FormatAddr.Customer(CustAddr,Customer);
    ShowItInColumn1 := FALSE;
    ShowItInColumn2 := TRUE;
    ShowItInColumn3 := FALSE;
    FormatAddr.Customer(ArrayOf8,Customer);
    IF ShowItInColumn1 THEN BEGIN
    FOR i := 1 TO 8 DO
    CustAddr[i+0] := ArrayOf8[i+0];
    END;
    IF ShowItInColumn2 THEN BEGIN
    FOR i := 1 TO 8 DO
    CustAddr[i+8] := ArrayOf8[i+0];
    END;
    IF ShowItInColumn3 THEN BEGIN
    FOR i := 1 TO 8 DO
    CustAddr[i+16] := ArrayOf8[i+0];
    END;

    (+0 because the i in brackets means something in this text editor)
  • dynamics navdynamics nav Member Posts: 50
    I worked on your process..data was not hiding and columns are not moving..
  • TallyHoTallyHo Member Posts: 416
    edited 2016-08-22
    Please export your adjusted version of object R119 to text and attach it to
    your next reply. I'll try to pinpoint what's wrong.
  • dynamics navdynamics nav Member Posts: 50
    edited 2016-08-22
    I created a section design and wrote code in onaftergetrecord trigger in customer data item for hiding and moving the columns..

    onaftergetrecord() trigger:


    IF NOT Hide THEN
    FormatAddr.Customer(CustAddr,Customer);
    IF NOT HideName THEN BEGIN
    FOR i := 1 TO ARRAYLEN(Customer.Name) DO
    CustAddr[3] := Customer.Name;
    CustAddr[3] := CustAddr[2];
    TName[1] := Customer.FIELDCAPTION(Name);
    END;

    IF NOT HideAddress THEN BEGIN
    FOR i := 1 TO ARRAYLEN(Customer.Address) DO
    CustAddr[1] := Customer.Address;
    TAddress[1] := Customer.FIELDCAPTION(Address);
    END;

    IF NOT HideCity THEN BEGIN
    FOR i := 1 TO ARRAYLEN(Customer.City) DO
    CustAddr[2] := Customer.City;
    TCity[1] := Customer.FIELDCAPTION(City);
    END;

    IF NOT HideCountry THEN BEGIN
    FOR i := 1 TO ARRAYLEN(Customer.County) DO
    CustAddr[4] := Customer.County;
    TCountry[1] := Customer.FIELDCAPTION(County);
    END;


    IF NOT HideContact THEN BEGIN
    FOR i := 1 TO ARRAYLEN(Customer.Contact) DO
    CustAddr[5] := Customer.Contact;
    TContact[1] := Customer.FIELDCAPTION(Contact);
    END;

    while running the report I am not able to move the columns properly..
  • dynamics navdynamics nav Member Posts: 50
    Thank you Tally Ho for guiding me in writing the code...Now the data was hiding and columns are moving
  • TallyHoTallyHo Member Posts: 416
    You're welcome
  • But it is not working..
  • The above code was working for only one particular check box selected but when all the checkboxes are selected then the remaining columns need to print leaving the selected checkbox which are indicating the columns.
Sign In or Register to comment.