Friday, March 4, 2011

Iterating Through Records - Crystal Reports 2008

I need to know how to iterate through records in CR2008 and when it reaches a record that is NOT NULL, record that in a variable.

I have a formula called "frmAccum" that I drop in the details section and suppress it. I use this to gather information for each record that's processed. I also have a formula called frmReset where I rest the stringvar "person_name" to "" and I can drop that in a Group header to reset after a grouping.

When it comes across a person_name field that is NOT NULL and is not empty, I want it to retain the name in a variable to be used in the report header.

So something like this:

stringvar person_name;
whileprintingrecords;

If ({Command.personname} <> "") Then
    person_name := {Command.personname}

I can't get this combination to work. Any help is appreciated.

From stackoverflow
  • Well I didn't get a response and figured out how to modify my command, so that it put the name in all the fields in the column, so I can pull it now via Command.personname.

    If anyone comes back to read this and knows how to do this via Crystal syntax, it would be much appreciated.

  • whileprintingrecords;
    
    stringvar person_name;
    
    If Isnull({Command.personname}) Then
        person_name := {Command.personname}
    

0 comments:

Post a Comment