Nos. not showing well on report

liizzliizz Member Posts: 125
Hi all,

I want to do a search all Nos. on the Sales Shipment Header table based on the Order No. from the Sales Invoice Header.

When for a particular Order No. on the Sales Shipment Header, there is more than one No.. It is displaying only the last line(i.e 102003).

For e.g: Order No=101001; No: 102001, 102002, 102003

This is my codes:
SalesShptHeader.RESET;
SalesShptHeader.SETRANGE("Order No.","Sales Invoice Header"."Order No.");
IF SalesShptHeader.FINDSET THEN BEGIN
REPEAT
SalesShptNo:=SalesShptHeader."No.";
UNTIL SalesShptHeader.NEXT=0;
END;

Thanks
Liizz

Comments

  • ChinmoyChinmoy Member Posts: 359
    Where have you written this code?

    If you want to print multiple Nos., either take a dataitem (which will retrieve multiple records from the related table) and put a body section in the report for that dataitem or take a text variable (of big enough length) and concatenate the Nos. which you get looping through the records of the related table.

    Chn
  • liizzliizz Member Posts: 125
    I have instead concatenate the field No. but the nos. are displayed in a descending order now.

    This is the current output being shown: 100203,100202, 100201

    Please help.

    Thanks

    Liizz
  • ChinmoyChinmoy Member Posts: 359
    1.
    If header table then,
    SETCURRENTKEY("No.")

    Or

    If line table then,
    SETCURRENTKEY("Document No.",...) or whichever key starts with Document No., or create a new key with Document No.

    2. Concatenate like DocumentNo (Variable) := DocumentNo + ',' + <RecordVariable>."No." or <RecordVariable>."Document No."

    It should fetch the records in correct order.

    Chn
  • vijay_gvijay_g Member Posts: 884
    liizz wrote:
    This is my codes:
    SalesShptHeader.RESET;
    SalesShptHeader.SETRANGE("Order No.","Sales Invoice Header"."Order No.");
    IF SalesShptHeader.FINDSET THEN BEGIN
    REPEAT
    SalesShptNo:=SalesShptHeader."No.";
    UNTIL SalesShptHeader.NEXT=0;
    END;
    Liizz

    Make sure that your code should not like this
    SalesShptNo:=SalesShptHeader."No."+SalesShptNo;
    
  • liizzliizz Member Posts: 125
    Hello all,

    Problem solved. =D>

    Thanks for your suggestions

    Liizz
Sign In or Register to comment.