Complex child filter

From: Carolina (Carolina_at_discussions.microsoft.com)
Date: 02/21/05


Date: Mon, 21 Feb 2005 07:01:03 -0800

Hi!

I am trying to apply a fairly complex rowfilter to a datatable in a dataset
with two related tables. The filter should be applied to the parent table and
the effect I try to create is to filter out so that I only see the items
where one particular field has not changed from one child to the other...

I have managed to create the t-sql command that would acheive this, and I
was hoping that the where-clause could be applied to the rowfilter property
of my parent table's defaultview, but, it comes back throwing an exception
stating that it is missing an operand after the operator "AnstallningID".

This is one version of the syntax I have tried (Lon is my child table):
-----------------------
ID IN (SELECT AnstallningID FROM Lon LA WHERE LA.Version=1 AND LA.Belopp=
        (SELECT top 1 LB.Belopp FROM Lon LB where LB.Version=13 AND
LA.AnstallningID=LB.Anstallningid))
-----------------------

As you can see, "AnstallningID" is the field in my first inner select
clause. No matter what I try here, it complains on the first word after
"SELECT". Is the conclusion simply that inner selections are impossible?

Does anyone of you have an idea of how to implement a dynamic filter that
would solve my problem? I am not able to apply this filter at the datasource,
and I do not like the idea of looping through the data... The "dynamic", or
varying, parts of the filter are the two versions specified.



Relevant Pages