Sorting fails on child data item

maffmaff Member Posts: 2
Hi,

I am designing a report to print company contacts grouped by there industry group, and contact persons for each company. The structure is:

Contact Industry Group: SORTING(Industry Group Code) ORDER(Ascending)
-> Contact: SORTING(Name) ORDER(Ascending) WHERE(Type=CONST(Company)), No.=Field(Contact No.)
-> -> Contact: SORTING(Name) ORDER(Ascending) WHERE(Type=CONST(Person)), Company No.= Field(No.)

Name is of type Text and an active key in Table Contact, therefore I would expect my contacts to be sorted alphabetically, but they are not.

Following code run in Contact Industry Group - OnAfterGetRecord()
lreContact.SETCURRENTKEY(Name);
lreContact.SETRANGE(Type,lreContact.Type::Company);
//lreContact.SETRANGE("No.","Contact No.");
would select records in the correct order, while
lreContact.SETCURRENTKEY(Name);
lreContact.SETRANGE(Type,lreContact.Type::Company);
lreContact.SETRANGE("No.","Contact No.");
would not.

Thanks in advance,
Mart;n

Comments

  • Imranx101Imranx101 Member Posts: 21
    Because the No. is the primary key and it has the priority. Try to use ASCENDING function and see that happens.
Sign In or Register to comment.