changing line order on printed reports

lanemarklanemark Member Posts: 82
Is it possible to change the way a report is printed, eg. aged analysis report as a standard print has the order of customers by customer number, can this be changed so the order is by customer name so they are alphabetically together, at the moment they are jumbled all over the place.



  • SavatageSavatage Member Posts: 7,142
    If you're talking about the Aged Accounts Receiveable report - at the bottom right should be a sort button - change it to "Search Name"

    as long as your DataItemTableView hasn't been set
  • afarrafarr Member Posts: 287
    I want to have a default sort order on a report data item, but allow users to change this if they want.

    If I set the sort order in the TableView, then users cannot change it because no button appears in the request form.
    If I set it through code before the request form runs (OnInitReport), it gets reset to the primary key.

    So I want to set it through code *after* the request form has run (OnPreDataItem), but only if the user has not chosen a key.
    Is there a way of doing this?
    That is, is there a way to check if the user chose a specific key (possibly the primary key, which is the default) in the request form?

    Alastair Farrugia
  • SavatageSavatage Member Posts: 7,142
    If we're talking about the Aged Account Receiveable (for example)

    On the PreDataItem of the Customer Dataitem if you add
    SETCURRENTKEY("Search Name");

    you will see your report will now print in Name order.

    So one thought would to create a request form that lists all the possible sorts. Then the user can click a check box for the sort they want.
    then thru some code change the sort.

    SetcurrentKey("Search Name"); //Set a default
    If varBooleanSortNo
    then Setcurrentkey("No.");
    if varBooleanSlspersonCode
    then setcurrentkey("Salesperson Code");
    etc etc
  • afarrafarr Member Posts: 287
    Thanks for the suggestion.

    We considered that, but in the end just used the following code in OnPreDataItem:

    IF CURRENTKEY = ‘Entry No.’ THEN
    SETCURRENTKEY("Search Name"); // The new default key

    This replaces the Navision default key, i.e. the primary key "Entry No.", with my desired default, "Search Name".
    So the key defaults to "Search Name", unless the user has already chosen another key in the request form (except for "Entry No.").
    Unfortunately, I have no way of distinguishing between:
    a) the user doesn't select any key
    b) the user selects the "Entry No." key, which happens to be the current default.

    For our purposes, that's OK, but if it was an important issue then I would set up an option field as you suggested.
    Alastair Farrugia
Sign In or Register to comment.