MycroftMkIV
Programmer
Instead of re-writing 250+ reports when we change databases, our software uses the Crystal Reports API to change the report in memory for the given database. The new database we are using is a challenge, as it has been completely re-factored with new tables and field names.
This means we have to scan a particular Crystal Report in memory and change or destroy/recreate all the report's objects. We have done this for everything in the report and it works fine, except for a problem in one particular area.
One of our reports uses a condition field in the graph object as an 'On Change of' data item, with a connected TopN value. When we create a new field object with a new field name to replace the old field object, we lose that connected TopN value. We know this since the TopN value is no longer a requested parameter.
Here are the steps we perform
For each Condition Field in the graph object
Store the Condition Field in an array of IFieldDefinition
Store the Condition Field Sort Order in an array of CRSortDirection
Delete the Condition Field from the graph object
end
For each Condition Field in the array
If the Condition Field needs to be changed
Add the changed Condition Field object to the graph object
Set the sort order
else
Add the old Condition Field object to the graph object
Set the sort order
end
end
The Delete line is where we lose the TopN connection. If the old condition field object is added back to the graph object, the TopN no longer exists.
We can't figure out how to get information about TopN for the field before deleting, so we can add it back. Does anyone know anything about this?
Mike
This means we have to scan a particular Crystal Report in memory and change or destroy/recreate all the report's objects. We have done this for everything in the report and it works fine, except for a problem in one particular area.
One of our reports uses a condition field in the graph object as an 'On Change of' data item, with a connected TopN value. When we create a new field object with a new field name to replace the old field object, we lose that connected TopN value. We know this since the TopN value is no longer a requested parameter.
Here are the steps we perform
For each Condition Field in the graph object
Store the Condition Field in an array of IFieldDefinition
Store the Condition Field Sort Order in an array of CRSortDirection
Delete the Condition Field from the graph object
end
For each Condition Field in the array
If the Condition Field needs to be changed
Add the changed Condition Field object to the graph object
Set the sort order
else
Add the old Condition Field object to the graph object
Set the sort order
end
end
The Delete line is where we lose the TopN connection. If the old condition field object is added back to the graph object, the TopN no longer exists.
We can't figure out how to get information about TopN for the field before deleting, so we can add it back. Does anyone know anything about this?
Mike