Showing posts with label custom. Show all posts
Showing posts with label custom. Show all posts

Friday, March 23, 2012

GACUTIL.exe Not Available

Hello,

I am going through some examples on how to build custom tasks, and apparently, I don't have the gacutil.exe utility. I guess it does not come with the .NET Framework 1.1 or 2.0.

How do I get this utility?

Thank you for your help!

cdun2

Try installing the .Net Framework SDK 2.0 if it is really nowhere to be found. If you are using Visual Studio, I would have expected to be there as the SDK is part of the default install, it may even be required. Have you done a full Search on your machine?

It is not included with the smaller .Net Framework redistribution package aimed at client mahines.

|||

Thank you, I will look into this.

cdun2

Wednesday, March 7, 2012

Function call in Dataset Query

Hello Guys,

I have a question that seems easy but I can not figure out...

Premise:

Have Custom code that fixes Divide by Zero Errors in SSRS. I have added the code to the Custom Code area in Report Properties correctly.

I have a Dataset that has a calculation for a column within a select statement

Query Pseudocode:

select ...[FRC%]=convert(decimal(13,2),sum(cost))/convert(decimal(13,2),sum(income))...
,year
from

(subquery"blah" )

Union

(Subquery"blah")

Custom Code:

Public Function SafeDiv(ByVal numerator as Double, ByVal denominator as Double) as Double
if denominator = 0 then
return 0
else
return numerator/denominator
end if
End Function

How To use:

If you have a field that does division and you need to eliminate the divide by zero error that occurs with SSRS then type =code.SafeDiv(first,second) in the field.

Problem:

How do I add this code reference in the following dataset select statement

select ...[FRC%]=convert(decimal(13,2),sum(cost))/convert(decimal(13,2),sum(income))...
,year
from

(subquery"blah" )

Union

(Subquery"blah") table1


I tried to do this:

from this:

[FRC%]=convert(decimal(13,2),sum(cost))/convert(decimal(13,2),sum(income)) ...

to this

[FRC%]=code.Safediv(convert(decimal(13,2),sum(cost)),convert(decimal(13,2),sum(income))) ...


But it did not work...gave me this error:

TITLE: Microsoft Report Designer

An error occurred while executing the query.
Cannot find either column "code" or the user-defined function or aggregate "code.safediv", or the name is ambiguous.


ADDITIONAL INFORMATION:

Cannot find either column "code" or the user-defined function or aggregate "code.safediv", or the name is ambiguous. (Microsoft SQL Server, Error: 4121)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=4121&LinkId=20476


BUTTONS:

OK


Help!

P.S.

this is a Matrix report and this select statement is within one of the datasets that fill a matrix.

anyone...?|||

Hello,

Unfortunately, you can't use custom code in your SQL query (as you've found). What you can do is supply both fields in the calculation (cost and income) to the report and have it do the percentage, or create a 'SafeDiv' function in SQL and do it there.

Hope this helps.

Jarret

|||

On the DataSet

Use Generic Query Designer

Then you can use

="Select tableName.ProductID, "& code.Safediv(Parameters) & " as ColumnName

From tableName"

Try to adapts it to your report.

I hope it help you.

|||Thanks I will try it...|||

I think this will work...I will reply with result...

Thank You!

Sunday, February 19, 2012

Fulltext query with custom rank

Hi,
I brought this up once ago, but I read something which might open a
new possibility. What I am trying to do is this:
select p.Name, p.Score, ft.Rank
from Products p
join (
select [key], rank from
containstable(Products, Name, '"Screw*"', 10)
) as ft
on ft.[key]= p.ProductId
order by p.Score desc
Let's say "Products" contains one million products and there are 20000
matching products containing "screw" as a part of their name. What I
want to get are the top 10 products matching the query, but the FT
rank should equal the Score rank. I don't want this:
containstable(Products, Name, '"Screw*"', 50000)
and then join the resulting 20000 rows with products and order the set
by Score, since that will be too expensive.
Best would be, if I could actually set the value that the ranking
algorithm is based on. The indexer would simply use Score as the
predominant factor for the ranking. So
containstable(Products, Name, '"Screw*"', 10)
would return the first 10 matches but sorted by Score.

>From what I know this is not possible with FT in 2000 or 2005, but I
read that it is possible to use CLR integration to customize the
indexing process. However, I could not find anything in the docs about
that. Maybe one can only create indexes and stuff like that, but I am
still hoping that someone has a clue on how to possibly manipulate FT
rank in SQL Server 2005.
Kind regards
DC
DC,
I've created my own CLR function and use it instead of FTS rank. It gives
much better result (by similarity)
I use Levenshtein Edit distance to calculate the score.
Thanks,
Yuri
"DC" wrote:

> Hi,
> I brought this up once ago, but I read something which might open a
> new possibility. What I am trying to do is this:
> select p.Name, p.Score, ft.Rank
> from Products p
> join (
> select [key], rank from
> containstable(Products, Name, '"Screw*"', 10)
> ) as ft
> on ft.[key]= p.ProductId
> order by p.Score desc
> Let's say "Products" contains one million products and there are 20000
> matching products containing "screw" as a part of their name. What I
> want to get are the top 10 products matching the query, but the FT
> rank should equal the Score rank. I don't want this:
> containstable(Products, Name, '"Screw*"', 50000)
> and then join the resulting 20000 rows with products and order the set
> by Score, since that will be too expensive.
> Best would be, if I could actually set the value that the ranking
> algorithm is based on. The indexer would simply use Score as the
> predominant factor for the ranking. So
> containstable(Products, Name, '"Screw*"', 10)
> would return the first 10 matches but sorted by Score.
> read that it is possible to use CLR integration to customize the
> indexing process. However, I could not find anything in the docs about
> that. Maybe one can only create indexes and stuff like that, but I am
> still hoping that someone has a clue on how to possibly manipulate FT
> rank in SQL Server 2005.
> Kind regards
> DC
>
|||Hi Yuri,
very interesting, were you able to manipulate the fulltext index
ranking, i.e. would
containstable(Products, Name, '"Screw*"', 10)
return the top 10 results as calculated by your algorithm?
Do you maybe have a link or a topic to look for about this kind of CLR
integration?
Regards
DC
On 15 Mai, 20:41, ynogin <yno...@.discussions.microsoft.com> wrote:
> DC,
> I've created my own CLR function and use it instead of FTS rank. It gives
> much better result (by similarity)
> I use Levenshtein Edit distance to calculate the score.
> Thanks,
> Yuri
>
> "DC" wrote:
>
>
>
>
>
> - Zitierten Text anzeigen -
|||DC,
The syntax I use is more like:
Select top(@.n_rows) *,my_score_fn(your_column,@.your_value)
from your_table
where containstable(your_column,@.your_value)
order by my_score_fn(your_column,@.your_value) desc
You also can use freetexttable function instead.
Thanks,
Yuri
"DC" wrote:

> Hi Yuri,
> very interesting, were you able to manipulate the fulltext index
> ranking, i.e. would
> containstable(Products, Name, '"Screw*"', 10)
> return the top 10 results as calculated by your algorithm?
> Do you maybe have a link or a topic to look for about this kind of CLR
> integration?
> Regards
> DC
>
> On 15 Mai, 20:41, ynogin <yno...@.discussions.microsoft.com> wrote:
>
>
|||Hi Yuri,
if containstable(your_column,@.your_value) returns 100.000 results,
then my_score_fn will have to do a lot of sorting.
This is exactly the problem that I am facing, where out of about one
million indexed rows easily 10 to 100 thousand results are being
returned by weak queries.
For your function my_score_fn it would probably not be of much value
to do what I am trying, since my_score_fn takes the search argument as
a parameter. So you cannot precalculate your desired ranking and store
it into an additional column. But my "Score" is totally independant of
the search argument. The RANK that sql server calculates is useless
for me. Since
containstable(Products, Name, '"Screw*"', 10)
gives the top 10 results by RANK, I only see the chance to manipulate
RANK generation somehow. But I apprehend that this is not possible at
all.
Regards
DC
On 16 Mai, 17:14, ynogin <yno...@.discussions.microsoft.com> wrote:
> DC,
> The syntax I use is more like:
> Select top(@.n_rows) *,my_score_fn(your_column,@.your_value)
> from your_table
> where containstable(your_column,@.your_value)
> order by my_score_fn(your_column,@.your_value) desc
> You also can use freetexttable function instead.
> Thanks,
> Yuri
>
> "DC" wrote:
>
>
>
>
>
>
>
>
>
>
> - Zitierten Text anzeigen -
|||DC,
You actually can put a trash holder like
Select ...
Where score_fn(search_column,@.value) > 30 --in percent
order by ...
This way you will cut out most of the low "similarity" matches and your
result set will be a lot smaller.
Thanks,
Yuri
"DC" wrote:

> Hi Yuri,
> if containstable(your_column,@.your_value) returns 100.000 results,
> then my_score_fn will have to do a lot of sorting.
> This is exactly the problem that I am facing, where out of about one
> million indexed rows easily 10 to 100 thousand results are being
> returned by weak queries.
> For your function my_score_fn it would probably not be of much value
> to do what I am trying, since my_score_fn takes the search argument as
> a parameter. So you cannot precalculate your desired ranking and store
> it into an additional column. But my "Score" is totally independant of
> the search argument. The RANK that sql server calculates is useless
> for me. Since
> containstable(Products, Name, '"Screw*"', 10)
> gives the top 10 results by RANK, I only see the chance to manipulate
> RANK generation somehow. But I apprehend that this is not possible at
> all.
> Regards
> DC
>
> On 16 Mai, 17:14, ynogin <yno...@.discussions.microsoft.com> wrote:
>
>
|||Hi Yuri,
if I do this:
select p.name, p.score
from containstable(products, name, '"al*"') ft
join products p on p.id = ft.[Key] and p.score > 100
it will still take the fulltext service a long time to dig up ALL
products matching "al*" and it will filter the ones with a score of
100 or less afterwards.
This, on the other hand, will be a lot faster:
select p.name, p.score
from containstable(products, name, '"al*"', 200) ft
join products p on p.id = ft.[Key] and p.score > 100
because the ft index only returns the first 200 rows matchin "al*" and
then the p.score > 100 clause will be applied... so there is probably
no match left.
My whole point is, that I want this
containstable(products, name, '"al*"', 200)
to return the first 200 products matching "al*" but sorted by "score
desc". Normally
containstable(products, name, '"al*"', 200)
will return the first 200 matches sorted by RANK, and that RANK is
being calculated by ft index engine. What I want is to produce a
custom RANK.
Regards
DC
On 18 Mai, 15:16, ynogin <yno...@.discussions.microsoft.com> wrote:
> DC,
> You actually can put a trash holder like
> Select ...
> Where score_fn(search_column,@.value) > 30 --in percent
> order by ...
> This way you will cut out most of the low "similarity" matches and your
> result set will be a lot smaller.
> Thanks,
> Yuri
>
> "DC" wrote:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> - Zitierten Text anzeigen -