Sorting using custom functions

Stimulsoft Reports.NET discussion
ajoos
Posts: 15
Joined: Wed Dec 11, 2013 1:24 pm

Sorting using custom functions

Post by ajoos »

Hey; I have successfully created a custom function and registered it using the following method:

Code: Select all

StiFunctions.AddFunction(Category, "LookupCode", "LookupCode", "..", typeof(GReportLookupResolver),typeof (object), "...", ParamTypes, ParamNames, ParamDescrips);
This works very well, and I get a nice overview on my function is the designer. Also, the function works like a charm when using it to display values in a table or databand:
{LookupCode(Datenquelle1,"ART",Datenquelle1.ART)}

When I, however, want to use the return value of this function to actually sort a table or databand, I get the following error from the report checker:
Umwandlungsfehler, Ein Umwandlungsfehler wurde im Report 'Report' gefunden. Der Name 'LookupCode' ist im aktuellen Kontext nicht vorhanden.
(LookupCode can not be found in the current context..)

Looking at the source code of the report, I do see the problem: When using the function to display a value, the Designer automatically qualifies the function with the namespace. When using it as a sort statement, this does not happen.

Is this a bug? Is there something that I could do about it?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Sorting using custom functions

Post by Alex K. »

Hello,

Can you please send us a sample with test data which reproduce the issue for analysis.

Thank you.
ajoos
Posts: 15
Joined: Wed Dec 11, 2013 1:24 pm

Re: Sorting using custom functions

Post by ajoos »

Hi. I have created a small solution containing the designer, and one special function that's registered with the report using the StiFunctions.AddFunction() method. Also, I add a small datatable so that there's data to test without the need to fiddle with database connections.

The zip contains two report files:
* NonWorking.mrt -> Created solely using drag&drop in the Designer: Added the table, added a row, displaying the Attribute1-values processed trough my function -> works. Then, I've added the same method as sort-function to the table. -> The report checker gives an error.
* Working.mrt -> I extended the NonWorking.mrt manually by adding fully qualified function name ({ReportReproCase1.MyFunction.ExtendedNumberSort(ReproData.Attribute1)}) in the sort-definition of the table -> This works.

Is this a bug? Shouldn't the functions automatically be fully qualified when adding them to the report? Should the report know about the registered functions? How to do this correctly?

Thanks!
Attachments
ReportReproCase1.zip
(14.75 KiB) Downloaded 319 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Sorting using custom functions

Post by Alex K. »

Hello,

We found some issues with sorting. Need some time for check it.
In your report please try to use the following expression in Sorting:
ReportReproCase1.MyFunction.ExtendedNumberSort(ReproData.Attribute1)

Thank you.
Attachments
NonWorking_modified.mrt
(7.36 KiB) Downloaded 392 times
ajoos
Posts: 15
Joined: Wed Dec 11, 2013 1:24 pm

Re: Sorting using custom functions

Post by ajoos »

Hi Aleksey. Thank you for your reply. In my repro data, I've already supplied "Working.mrt" that does use the fully qualified function name (see my original post) -> That's what you suggest. This does work for us as a first solution - however, we have customers/users that do defined their own reports and in that case, it's not an option to do it that way. It needs to work "out of the box/designer" :-) It would be good if you just behaved the same as with the display fields, where the qualification with the namespace works well. Please keep me updated on news/progress on this. Thank you!
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Sorting using custom functions

Post by Alex K. »

Hello,

We need some additional time for fix the issue. We will let you know about the result.

Thank you.
ajoos
Posts: 15
Joined: Wed Dec 11, 2013 1:24 pm

Re: Sorting using custom functions

Post by ajoos »

Hello! Have you found a solution to this or an explanation? We're heading towards a release and I would be happy to solve this :-) Thanks!
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Sorting using custom functions

Post by Alex K. »

Hello,

We work hard on this problem and do our best to do it as fast as possible. We will let you know when the solution is available.
ajoos
Posts: 15
Joined: Wed Dec 11, 2013 1:24 pm

Re: Sorting using custom functions

Post by ajoos »

Thank you Aleksey!
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Sorting using custom functions

Post by Alex K. »

Hello,

Let us know if you need any additional help.
Post Reply