Page 1 of 2
Sorting using custom functions
Posted: Tue Feb 04, 2014 1:03 pm
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?
Re: Sorting using custom functions
Posted: Wed Feb 05, 2014 6:51 am
by Alex K.
Hello,
Can you please send us a sample with test data which reproduce the issue for analysis.
Thank you.
Re: Sorting using custom functions
Posted: Wed Feb 05, 2014 8:06 am
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!
Re: Sorting using custom functions
Posted: Thu Feb 06, 2014 7:49 am
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.
Re: Sorting using custom functions
Posted: Thu Feb 06, 2014 8:03 am
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!
Re: Sorting using custom functions
Posted: Thu Feb 06, 2014 12:38 pm
by Alex K.
Hello,
We need some additional time for fix the issue. We will let you know about the result.
Thank you.
Re: Sorting using custom functions
Posted: Tue Feb 18, 2014 6:48 am
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!
Re: Sorting using custom functions
Posted: Tue Feb 18, 2014 7:03 am
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.
Re: Sorting using custom functions
Posted: Tue Feb 18, 2014 7:07 am
by ajoos
Thank you Aleksey!
Re: Sorting using custom functions
Posted: Tue Feb 18, 2014 7:14 am
by Alex K.
Hello,
Let us know if you need any additional help.