Skip to Content
0
Former Member
Apr 10, 2014 at 01:33 PM

export shared variable string to csv truncates the string

52 Views

I have two databases that store information on customer appointments:

AppointmentMaster has 1 record for each appoint:

Customer Name ApptDate ApptID 2554 Smith, Bob 20140301 100 2468 Jones, Grace 20140301 101 2795 Roberts, Sam 20140302 102 2408 Harris, Chuck 20140305 103

AppointmentDetails holds a record for each operation performed at the appointment (sometimes none, sometimes dozens):

ApptID Operation OpDescription 100 A10 Corrected the A10 unit. 100 IA Resolved issues with internal account 100 C5 Brief consult with client 101 A10C Replaced cage on A10 unit. 101 U1 Updated customer account 103 C5 Brief consult with client.

My client needs a CSV file that contains 1 line per appointment. One of the fields in the CSV is a pipe separated listing of any and all operation codes performed at the appointment. The CSV file would look like this:

"2554", "Smith,Bob", "20140301", "A10|IA|C5|"

"2468", "Jones, Grace", "20140301", "A10C|U1|"

"2795", "Roberts, Sam", "20140302", ""

"2408", "Harris, Chuck", "20140305", "C5|"

I have a crystal report created that displays the fields correctly, however when I go to export to CSV I am seeing a file like this:

"2554", "Smith,Bob", "20140301", "C5|"

"2468", "Jones, Grace", "20140301", "U1|"

"2795", "Roberts, Sam", "20140302", ""

"2408", "Harris, Chuck", "20140305", "C5|"

Only the last Operation is getting exported into CSV even though all of them display.

If I export as PDF, Excel or Record Style the file has all of the operations. Unfortunately I need a CSV. I am trying to avoid having to do multiple reports and stitch them together with a script if possible; The client wants to be able to easily run and export this themselves on demand.

I created three formula fields to initialize, update and display a shared variable that concatenates the operations together.

My report is grouped by the ApptID and looks like this:

Group Header #1 (suppressed)

{@InitializeOperations}:

WhilePrintingRecords;

shared StringVar Operations := "";

Details (suppressed)


{@UpdateOperations}:

WhilePrintingRecords;

shared StringVar Operations := Operations + {AppointmentDetails.Operation} + "|";

Group Footer #1

{AppointmentMaster.Customer}

{AppointmentMaster.Name}


{AppointmentMaster.ApptDate}


{@DisplayOperations}:

WhilePrintingRecords;

shared StringVar Operations;

I have tried using `evaluateAfter(@UpdateOperations)` instead of `WhilePrintingRecords` on the @DisplayOperations, and have even tried removing any Evalutation Time command from it as well, but I still can't get the desired effect in the CSV file despite having it look correct on screen and every other way I have tried to export it.

Any help you can provide is appreciated.