Databand sort numerics Nulls last
Is there a way to sort in Databand integer values that can contain NULL-Values as I do in MySQL --> ORDER BY IfNull(res.Heben_Platz, 1000) ASC?
If I pass the ordered datatable to FR using no sort expression it still sorts NULL,1,2... Even the integer values will be sorted like strings 1,10,11,2.
An sort expression like "IIf(not IsNull("protokoll.Heben_Platz"),[protokoll.Heben_Platz],1000)" does not help either.
Thanks for any help.
If I pass the ordered datatable to FR using no sort expression it still sorts NULL,1,2... Even the integer values will be sorted like strings 1,10,11,2.
An sort expression like "IIf(not IsNull("protokoll.Heben_Platz"),[protokoll.Heben_Platz],1000)" does not help either.
Thanks for any help.
Comments
a. easy way : custom function
b. hard way : linq
First of all I do not understand how do you create the datasource "nullable".
Then my datasource is a datatable derived from MySQL database with many Columns. I could build a sorted list from it (if sorted list is supported), but I really do not understand the concept of the file you posted here.
Is there a source for some material to learn about FR? I only can find outdated manuals.
1. fastreport as standalone, pull data from database with built-in classes
2. push data from main application (winforms, wpf, web apps) to fastreport
i attached samples for demonstration:
1. instagram.frx , standalone report, pull data from internet, a json format, don't forget to copy Newtonsoft.Json.dll into C:\Program Files\FastReports\FastReport.Net Trial, because the dll must exists along with designer.exe
2. a console project, how to push data to fastreport and custom sort
basically, two kinds of data object are processed internally by fastreport :
1. business object (data model or data transfer object, whatever)
a. if you pushed data from main app with code : report.RegisterData(list, "BODatasource");
b. you can catch the object from report script : BusinessObjectDataSource data = Report.GetDataSource("BODatasource") as BusinessObjectDataSource;
c. where is my business object? and...
2. datatable
a. if you pushed data from main app with code : report.RegisterData(datatable "DataTableDatasource");
b. you can catch the object from report script : TableDataSource data = Report.GetDataSource("DataTableDatasource") as TableDataSource;
c. where is my datatable?
Sorry to bother you again...
- type "DataTable" does not exist
- I cannot find any hint how and where to set the mentioned references
As a workaround I added a datacolumn to my table where all Nulls are converted to 1000 and this works too.
Something else: is it possible to hide a groupheader conditionally?
I have a table with "GroupNumber" and "Divider". If Divider=Null then the GroupHeader should not be shown.
for reference: https://benohead.com/three-options-to-dynam...te-csharp-code/
dynamic class is a trade off between speed and flexibility/convenience.