From a Form retrieve a Value from a Table

mnewmediamnewmedia Member Posts: 13
Hello togheter! I'm new to Navision and to Mibuso.

I made a Form, on this Form i put a TextBox this should show me the invoiced price/cost of all jobs.
I found the table "Job Task 1001" and there is the value i want the field "Contract (Invoiced Cost)".

I tried to put in the SourceExp: JobTaskRec."Contract (Total Price)" but the value is then ever 0.00. maybe because it's a flowfield
and I have to insert somewhere a clalcfield statement?

So now, how do i get this value showed in my TextBox?

Thanks for any help or hint.
mnewmedia
NAV 2009 R2
NAV 2013 R2

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Welcome to Mibuso :D

    What is the source table of the form?

    did you try something?
  • mnewmediamnewmedia Member Posts: 13
    Thanks for Reply :D
    did you try something?

    Yes, I tried to put in the SourceExp: JobTaskRec."Contract (Total Price)" but the value is then ever 0.00. maybe because it's a flowfield

    I could get it work, but with C/AL Code. And i think there must be an other way with the SourceExp :-k .
    Vars:
    -JobInvoiced = dezimal
    -JobTaskRec = Record, Job Task
    
    JobTaskRec.GET('1','WEB');
    JobTaskRec.CALCFIELDS("Contract (Invoiced Price)");
    JobInvoiced := JobTaskRec."Contract (Invoiced Price)"
    
    I didn't define a SourceTable because, i make for learning purposes a Form like a Quickview of open bills, payed bills, invoiced jobs, amount of articels and so on. To do this i need a lot values of different tables so i could not decide me for a SourceTable.
    mnewmedia
    NAV 2009 R2
    NAV 2013 R2
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Some points to note:
    1. first you should get all the jobs from Jobs table
    2. repeat the jobs and then get the Job tasks for the above jobs
    3. repeat job tasks and save the value in variable..

    Please try and let me know..
  • mnewmediamnewmedia Member Posts: 13
    dadaaa \:D/
    Trigger: Form - OnOpenForm:
    
    IF JobTaskRec.FIND('-') THEN
    REPEAT
      JobTaskRec.CALCFIELDS("Contract (Invoiced Price)");
      TotalJobInvoiced := TotalJobInvoiced + JobTaskRec."Contract (Invoiced Price)";
    UNTIL JobTaskRec.NEXT = 0;
    

    And then i did the TotalJobInvoiced variable in the SourceExp of the TextBox. That works now fine..

    1. but is this a clean way?
    2. Isn't there a way to get this without writing C/AL Code?
    3. And do i have to define a SourceTable or is it in my case bette to leave it blank?
    4. is it possible to insert this Code in a function and pass the Record and Field with a paramater?

    Thanks!
    mnewmedia
    NAV 2009 R2
    NAV 2013 R2
Sign In or Register to comment.