Experts Advise

ameenameen Member Posts: 217
Hi ,

I am fresher to navision. I got one problem.I creating a sales invoice report. In that report client is asking customer
1.Phone No
2.L.s.T.No
3.C.S.T.No
4.E.C.C.No
5.P.A.N.NO
6.T.I.N.NO some more he is asking.
Thart above fields are not sale order. How get get that fields in sales invoice.
I planned in one way that is. I need to add these fields to sales header and sales shipment header ,sales invoice header and salesSales Credit Memo Header ,return receipt header....... with same field Id.
what i think this process is not good as per my knowledge.
Experts u can have different thoughts on this.
So throw u r valuable suggestions. ](*,) ](*,) ](*,)

thanks and regards
ameen

Comments

  • NagiNagi Member Posts: 151
    Hi Ameen,

    If you want to access fields in other tables than the one you're working with, you need to do this through record variables. Add a variable, such as 'Cust' aimed at the Customer table, and use appropriate filters to get the correct value; you could filter the Cust variable with the Sell-to Customer No. field in the Sales Invoice Header table. Then you add variables that take their value from the different fields in the Customer table.

    In C/AL it would look something like this..

    IF Cust.GET("Sales Invoice Header"."Sell-to Customer No.") THEN BEGIN
    varPhoneNo := Cust."Phone No.";
    varLstNo := Cust."L.s.T.No."; // Assuming this field is in the Customer table.
    etc..
    END;

    Then you add textbox controls on your report sections to display the variables.

    I hope this answered your question.
  • ameenameen Member Posts: 217
    Thank U so much Nagi,


    IF Cust.GET("Sales Invoice Header"."Sell-to Customer No.")
    Could u Explain this above code. How it is getting that customer details.
    Where i have to write that code that means in Dataitem (sales invoice header) triggers or report triggers. can u tell that rigger.


    thanks and regards
    ameen
  • NagiNagi Member Posts: 151
    There are different ways of retrieving record variables. Using GET retrieves a record variable based on the record's primary key. In case of the Customer table, the primary key is Customer No. You can use GET with compound primary keys by adding more fields to the function call.

    It's always a good idea to use GET in an IF statement, in case the system fails to retrieve the record. This way, you avoid run-time errors. This is also true of retrieving records with other functions.

    Other common ways of retrieving record variables include FINDFIRST and FINDLAST. With these functions, you usually have to set filters to ensure that you retrieve the correct records. After having used FINDFIRST, you could use REPEAT..UNTIL recVar.NEXT = 0 to run through the list of retrieved records.

    I suggest you read about record variables and record functions in the C/SIDE reference guide.

    Usually, it's enough to add the Cust.GET (or whatever record you are trying to retrieve in which ever way) in the data item's OnAfterGetRecord.

    I'm a newbie myself, so I'm just happy that I can finally help someone \:D/
Sign In or Register to comment.