Problem with FlowField/Calcfield in a report

mgerhartzmgerhartz 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):
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!

Answers

  • mgerhartzmgerhartz Member Posts: 50
    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?
  • kinekine Member Posts: 12,562
    edited 2006-05-02
    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);
    
    or
    Structure.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...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • mgerhartzmgerhartz Member Posts: 50
    Hey Guys, thank you for the answers. This makes sense! By
Sign In or Register to comment.