showing new field in the machine card

mark_christsmark_christs Member Posts: 156
Dear All experts,
I have created a new field in the machine card. The field relates to capacity ledger entry. The field data is from it. I have set the properties as follows:
The field type is decimal
fieldclass : normal
tablerelation : capacity ledger entry.newfield.where(type=filter(machine center),no=field(no)))
editable : no

but when I open the card the field is still empty or zero (o) and I still have to drilldown and click the value and click OK button. I want it filled automatically (every result of output journal posted) and only shows the value of the newest posting date (the very bottom line). for example, I post 90, then in the capacity ledger entry, there is 90 in the field and in the machine card is also 90, without drill it down to fill it manually.
I also try using set up as follows:
fieldclass : flowfield
calcformula : lookup("capacity ledger entry",new field.where(no.=field(no).prod.order no. = filter(newprod. order)))

but still not work.



Pls let me know how to make it work. I appreciate your answer very much.

rgds,
Mark

Comments

  • kinekine Member Posts: 12,562
    1) If you need to have the value calculated automatically, you need to use the FlowField type of the field (the second example you wrote)

    2) With the Lookup is problem that it will take first found value. Lookup is just only for cases when you can filter out one record (for example if you know the PK values). If you need to have some value from last record, it is not possible to do that through flowfield without using some C/AL code.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • mark_christsmark_christs Member Posts: 156
    Thank you for your reply. you wrote:
    If you need to have some value from last record, it is not possible to do that through flowfield without using some C/AL code.

    Could you pls let me know the C/AL code ?
    I actually wonder how the C/AL editor work in navision ? what is .net, how to make C/AL editor and how navision could be such an executable file but Ican write code there ? I've seen and used visual basic program but this navision seems wonderful.

    rgds,
    Mark
  • kinekine Member Posts: 12,562
    Could you pls let me know the C/AL code ?
     CapacityLedgerEntry.SETRANGE("no.","NoValue");    //filtering for the values you want to filter...
     CapacityLedgerEntry.SETRANGE("prod.order no.","newprod. order value");
     if not CapacityLedgerEntry.FIND('+') then
      CapacityLedgerEntry.INIT;    //to clear data if nothing found
    
      BlaBlaBla := CapacityLedgerEntry."new field"; //there you have the value of last entry or clear field if nothing found
    
    

    Of course, this code has many errors, because is filtering some fields but there is not selected correct key (it means performance problems), it assume that the records in the variable CapacityLedgerEntry are sorted in order from Oldest to Newest... etc. But take it only as example how you can find some last record based on some filters...
    I actually wonder how the C/AL editor work in navision ? what is .net, how to make C/AL editor and how navision could be such an executable file but Ican write code there ? I've seen and used visual basic program but this navision seems wonderful.

    rgds,
    Mark

    Welcome into world of wonders... 8)
    For starting I advice you to read the basic developer documentation (on product CD in DOC folder file w1w1adg.pdf).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • mark_christsmark_christs Member Posts: 156
    Thanks for your reply. I will try and pls let me know if I can use the function of average or not.


    rgds,
    MArk
Sign In or Register to comment.