Hi,
I have found that since upgrading to SP15, setting ReportDocument.RecordSelectionFormula to anything else (e.g. appending additional filter criteria) resets the RecordSelectionFormula property to blank.
Same goes for ReportDocument.DataDefinition.RecordSelectionFormula property, whereas the read only (and undocumented) ReportDocument.DataDefinition.RecordSelectionFormulaRaw property returns what the ReportDocument.RecordSelectionFormula property was actually set to.
The ability to update the RecordSelectionFormula is critical to the way our reports are run so this needs addressed urgently. In the meantime I have rolled back to SP14 where it works fine.
Can this please be investigated and a hot fix issued?
Thanks,
Gareth
Request clarification before answering.
Thanks very much for your investigative work, Gareth.
On one report I was doing the following :
string[] aryIDs = IDs.Split(',');
for (int c = 0; c < aryIDs.Length; c++) {
rep.RecordSelectionFormula += "{HIREITEMS.ID}=" + aryIDs[c] +
((c + 1) < aryIDs.Length ? " Or " : "");
}
As you said, this fails in recent versions of Crystal Reports! It just makes rep.RecordSelectionFormula = ""
I have now changed this to :
string[] aryIDs = IDs.Split(',');
string rsf = "";
for (int c = 0; c < aryIDs.Length; c++) {
rsf += "{HIREITEMS.ID}=" + aryIDs[c] +
((c + 1) < aryIDs.Length ? " Or " : "");
}
rep.RecordSelectionFormula = rsf;
...which works perfectly.
No idea why they have to break things like this!
Thanks again
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Guys for the update...
The reason we reserved those characters is because they are specific when the engine evaluates the report at runtime. CR Designer is a design tool so you can save errors in the report without it breaking.
The SDK on the other hand "assumes" the report is 100% valid, meaning no reserved characters are used, our parsing code has to load all formulae and object properties to evaluate them in the formatting engine.
So if you use something that is not allowed it can cause problems, I highly recommend you validate your report output data to confirm they are working properly.
The change was likely done for performance reasons, which is why a new API was created to get formula with comments:
myRecordSelectionWithComments.FreeEditingText
And there has always been an "Order" when processing a report, things can change that may look like it was broken but some change now forces you to do it in the right order.
Another example is when connecting to a Stored Procedure with Parameters, the parameter collection must be updated before the connection is made, where as if using a CR Parameter then the connection can be made first....
Also be aware that CR for .NET relies on the the Windows Framework heavily... if MS changes things it can affect how you code when using CR Assemblies...
Anyways, glad you guys figured it out...
Don
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.