Can't retrieve the Amount Including VAT value
ombacke
Member Posts: 44
Hi Guys,
I wrote some code that goes into the Sales Hearder Table and i'm trying for a record to get the value of the Amount Including VAT field.
refTable.OPEN(intTableNo);
refTable.GET(recId);
refField := refTable.FIELD(intFieldNo);
IF UPPERCASE(FORMAT(refField.TYPE)) = 'OPTION' THEN
txtFieldValue := FORMAT(refField.OPTIONCAPTION)
ELSE
txtFieldValue := FORMAT(refField.VALUE()) ;
intTableNo is the id of the table, intFieldNo, is the ID of the field here it is 61 but when this is done the txtFieldValue is always set to 0 even if for the record there actually is a value different from 0. (I ran the table and the form and found these out)..
I reaaly need some help..
Thank you
I wrote some code that goes into the Sales Hearder Table and i'm trying for a record to get the value of the Amount Including VAT field.
refTable.OPEN(intTableNo);
refTable.GET(recId);
refField := refTable.FIELD(intFieldNo);
IF UPPERCASE(FORMAT(refField.TYPE)) = 'OPTION' THEN
txtFieldValue := FORMAT(refField.OPTIONCAPTION)
ELSE
txtFieldValue := FORMAT(refField.VALUE()) ;
intTableNo is the id of the table, intFieldNo, is the ID of the field here it is 61 but when this is done the txtFieldValue is always set to 0 even if for the record there actually is a value different from 0. (I ran the table and the form and found these out)..
I reaaly need some help..
Thank you
0
Comments
-
refTable.GET(recId);
GET paramater are primary key of the table. In your case, You have Only the Document No.. You need the document type.0 -
Thanks for the answer.. And how would I get the Document Type?0
-
well quote is 0, order is 1, invoice is 2
Something like this;
refTable.GET(1,recId);
I don't know the reason why you are using reftable instead of record type.0 -
"Amount Including VAT" is a flowfield , so a CALCFIELDS is necessary to retrieve the amount.Kai Kowalewski0
-
So what would be the best way to get its value? Should I get all the salelines for that salesheader and add up their amount values?0
-
ombacke wrote:So what would be the best way to get its value? Should I get all the salelines for that salesheader and add up their amount values?
You do have "Amount with VAT" sum in Sales Header table and it's in a form of a flow field (so, through code you have to do CALCFIELDS before using it) and it has a value only when sales order is launched (if you want to get values for sales orders).0 -
Thank you very much Pheno your solution solved my problem, I needed to use calcfield...
Now I have another question: In C/Side is the a way once you have a reference to the field refField to know whether the field is a FlowField or not through code??0 -
ombacke wrote:Thank you very much Pheno your solution solved my problem, I needed to use calcfield...
Now I have another question: In C/Side is the a way once you have a reference to the field refField to know whether the field is a FlowField or not through code??
When I don't know what properties and methods I have on a single type of var, I usually insert one testing global var (for your example with type of: FieldRef). After that, you can use C/AL Symbol Menu (or F5), find that var and check what can you do with that type of var.
In your example, there is a CLASS property that says is it a flowfield, flowfilter or regular field.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

