Problem with FlowField/Calcfield in a report

mgerhartz
Member Posts: 50
Hi,
I have the following problem. I want to use records from the contact table to create new records in the structure table. I've ceated a report with the DataItem (Structure). The report itself works fine, but I have a problem with some FlowFields. I know, that I have to use the CALCFIELDS. Here's a part of my code written in the OnAfterGetRecord Trigger of the DataItem (Structure):
Actually, the CalcForumla for the FlowField Comment is:
Exist("Comment Line" WHERE (Table Name=CONST(Customer),No.=FIELD(No.)))
So what's wrong? Thank you guys!
I have the following problem. I want to use records from the contact table to create new records in the structure table. I've ceated a report with the DataItem (Structure). The report itself works fine, but I have a problem with some FlowFields. I know, that I have to use the CALCFIELDS. Here's a part of my code written in the OnAfterGetRecord Trigger of the DataItem (Structure):
Structure.SETFILTER(Structure.Inactive, 'Nein'); Structure.SETFILTER(Structure."Accounts Statement Liability", 'Ja'); IF ((NOT Rec_Customer.GET(Structure."Structure No.")) OR (NOT Rec_Customer.GET(Structure."Structure No."+'BP')) )THEN BEGIN Rec_Customer.INIT; Rec_Customer.CALCFIELDS(MarkerExistiert,"Customer Structure Exists", "State Organization","Region Organization",Comment); Rec_Customer.VALIDATE(Name, 'XYZ' + COPYSTR(Structure.Name,1,26)); Rec_Customer.VALIDATE(Rec_Customer."Invoice Disc. Code", Structure."Structure No."); // Rec_Customer.VALIDATE(Rec_Customer.Comment, False);When I try to run the report the following message appears: "The CalcFormula for the Comment FlowField in the Customer table should start with 'Sum(....'"
Actually, the CalcForumla for the FlowField Comment is:
Exist("Comment Line" WHERE (Table Name=CONST(Customer),No.=FIELD(No.)))
So what's wrong? Thank you guys!
0
Answers
-
I think, I know why it doesn't work. Because, the field "Comment" is a FlowField and gets the value through CALCFIELDS and I'm trying to fill the field with a fixed value (false).
So does anybody has a idea how to fill a FlowField with a fixed value?0 -
1)mgerhartz wrote:
Structure.SETFILTER(Structure.Inactive, 'Nein'); Structure.SETFILTER(Structure."Accounts Statement Liability", 'Ja');
Correct is (if the fields are boolean):Structure.SETRANGE(Structure.Inactive,False); Structure.SETRANGE(Structure."Accounts Statement Liability", True);
orStructure.SETFILTER(Structure.Inactive,'%1',False); Structure.SETFILTER(Structure."Accounts Statement Liability",'%1',True);
Do not forget, that you need to keep the code multilanguage-enabled.
2) Yes - Comment is calculated field and if you want to have it false, you just need to delete all records in "Comment Line" table for the customer...0 -
Hey Guys, thank you for the answers. This makes sense! By0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 320 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