How to display of the description of a related field?

boby
boby Member Posts: 78
edited 2010-09-06 in NAV Three Tier
Hello,
I'm a newbie in RTC, and I try to display the value of a field related to anoher table..
For example, in the item card, the payment method is "1", which is the code corresponding to "bank transfer" in the payment method table.. And I'd like to display "bank transfer" in place of (or beside) "1" in the item card..
Can you give me some tricks to do that??

Thanks for reading ;-)

Comments

  • Andwian
    Andwian Member Posts: 627
    Table Item
    Payment Method - OnValidate
    recPaymentMethod.GET(recItem."Payment Method");
    label."Payment Description" := recPaymentMethod."Description";
    
    Regards,
    Andwian
  • ufuk
    ufuk Member Posts: 514
    To display it on RTC you have to add a new item on Page Designer having SourceExpr PaymentMethod.Description and get the value on Product Group Code - OnValidate() as:
    IF NOT PaymentMethod.GET("Payment Method") THEN
      PaymentMethod.INIT;
    
    Ufuk Asci
    Pargesoft
  • boby
    boby Member Posts: 78
    Thank you very much for your answers, but I've tried to put in the onaftervalidate of a custom field in the item table, the "label.field:=" causes a compilation error (undefined variable "label")..
    What Am I doing wrong?


    PS: I miss my old "classic" client ;-)
  • Andwian
    Andwian Member Posts: 627
    What is the design of yours? How do you want the Payment Method Description arise? Where? in any field or just label (I am sorry, I meant Textbox?), and when do you suppose it will be filled?
    Regards,
    Andwian
  • Andwian
    Andwian Member Posts: 627
    Are you sure it is Item Card? Not the Customer or Vendor card?
    Just curious why there is such Payment Method field in Item Card (or maybe just in your localization)
    Regards,
    Andwian
  • boby
    boby Member Posts: 78
    Hello,
    Thank you for your interest.
    In fact, I'm wrong in my example :oops: . I've created a table Colors, and added a field color in the item table. In the color table, I've a field code (related to another system, so I can't rename it) and a field description. I'd like to display the description of the color (blue, red...) and not the code (which make the link, but is 001,002,003)..
    I hope I've made it more easy to understand.
    I guess I've to work in the Page, not in the Table..

    Thanks again for your advices
    Boby
  • Andwian
    Andwian Member Posts: 627
    If understand you:
    1. There is a new field in Item table:
    a. Color Code
    b. Color Description
    2. I think you want the Color Description in Item table is updated when you fill the Color Code

    If so:
    1. Design Item table
    2. Add code in Color Code - OnValidate:
    recColor.GET(recItem."Color Code");
    "Color Description" := recColor."Description";
    
    3. This way, the Color Description in Item table will be populated when you input the Color Code
    4. This way too, you will see it on the Item page, since the information (record) to display in page are now available from it's table 8)
    Regards,
    Andwian
  • boby
    boby Member Posts: 78
    Thank you for your advice..
    I don't want to repeat the field already present in a separate table "color".. The item table is already very heavy (>10000 items) and the color description is quite long (250 characters)..
    Any other idea?
  • Andwian
    Andwian Member Posts: 627
    boby wrote:
    I don't want to repeat the field already present in a separate table "color".. The item table is already very heavy (>10000 items) and the color description is quite long (250 characters)..
    Any other idea?
    What is your idea then?
    Regards,
    Andwian
  • ufuk
    ufuk Member Posts: 514
    If you do not want description field to be exist in your table, then just use a variable as I mentioned before and add it to the appropriate place in Page Designer.
    Ufuk Asci
    Pargesoft