Showing posts with label condition. Show all posts
Showing posts with label condition. Show all posts

Monday, March 26, 2012

How to for date is not null or nothing condition

How can i write a condition for like isdate(Fields!DueDate.value)

I tried isdate but i am getting an error message. what is the equivalent for isdate in sql server reporting services formula fields or calculated fields expression.

Thank you very much for the information.

*********************************************

=IIF(isdate(Fields!DueDate.Value), ................

********************************************

Reddy,

Try

=IIf(IsDate(Fields!DueDate.value),"True","false")

This should work for you.

Ham

|||

Sorry should have read it all.

=IIf(Fields!DueDate.value is nothing,"False",IsDate(Fields!DueDate.value),"True","false"))

Ham

|||

There was a program error, I left out the next IIF statement

IIf(Fields!DueDate.value is nothing,"False",IIf(IsDate(Fields!DueDate.value),"True","false"))

Sunday, February 19, 2012

How to filter out unwanted nodes?

I would like to retrieve the values of ProductIDs nodes but the condition is to ignore any ProductIDs that is a child of <AlternativeState> node.

Please keep in mind that xml data comes from table and the value of ProductIDs could appear anywhere else as well so I am afraid using exact XPath is not a choice. The only time when ProductIDs is not returned when its a child of AlternativeState.

Currently I have something like this but it returns all of the productIDs from the xml instance

SELECT UsageID, xmlState.query('

for $productIDs in //*/ProductIDs

order by $productIDs

return string($productIDs)') AS ProductIDs

FROM Usage.UsageAnalysis

WHERE UsageID = 91923

<State>

<StatsState>

<CurrentState>

<OtherEvents>

<ProductIDs>46420</ProductIDs>

<AlternativeState><!-- Ignore anything in this element-->

<OtherEvents>

<ProductIDs>46420</ProductIDs>

</OtherEvents>

<MarketSize>

<ProductIDs>46431,46440,46469,46470</ProductIDs>

</MarketSize>

</AlternativeState>

</OtherEvents>

<CurrentEvent>MarketShare</CurrentEvent>

<MarketSize>

<ProductIDs>2128,2459,46420,46440,46470</ProductIDs>

</MarketSize>

</CurrentState>

</StatsState>

</State>

In your sample XML the AlternativeState element does not have a ProductIDs child, only a grand child. So for that XML sample the expression

Code Snippet

for $productIDs in //*[not(self::AlternativeState)]/*/ProductIDs

order by $productIDs

return string($productIDs)

should filter out what you want to filter out. Using an ancestor axis test should solve the problem in general but that axis is not currently supported in XQuery for SQL Server 2005.

How to Filter Expression in Data Region

how do i filter any expression in the data region
e.g. i want all users for just New York?
how to apply that filter condition in the expression in data region?See BOL:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rshowto/htm/hrs_designer_v1_3diq.asp
Example:
Filter expression: =Fields!City.Value
Operator: =Value expression: ="New York" or just New York (because it is a string)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Raj" <Raj@.discussions.microsoft.com> wrote in message
news:D5F8D505-BC13-4F20-887A-62BC1BF2A669@.microsoft.com...
> how do i filter any expression in the data region
> e.g. i want all users for just New York?
> how to apply that filter condition in the expression in data region?|||Sorry, but based on your questions I thought you want to filter data.
However, you actually want to calculate some aggregates. Try this
expression:
=Count( iif(Fields!City.Value = "New York", 1, Nothing) )
The count aggregate also takes a scope parameter, so depending on where you
use this expression in the report, you might need to add a scope for the
aggregate (e.g. the dataset name or containing reportitem name). E.g.:
=Count( iif(Fields!City.Value = "New York", 1, Nothing), "DataSet1" )
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Raj" <Raj@.discussions.microsoft.com> wrote in message
news:7031923E-DD39-4A21-9721-F9CEF898D707@.microsoft.com...
> hi robert
> i am still confused
> i have a field but i dont want to use filter on the fields.city.value
> i want to count users where city is new york
> 1 field in my table is userid
> 1 field is their residing city
> what shall i do?
> "Robert Bruckner [MSFT]" wrote:
> > See BOL:
> >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rshowto/htm/hrs_designer_v1_3diq.asp
> >
> > Example:
> > Filter expression: =Fields!City.Value
> > Operator: => > Value expression: ="New York" or just New York (because it is a string)
> >
> > --
> > This posting is provided "AS IS" with no warranties, and confers no
rights.
> >
> > "Raj" <Raj@.discussions.microsoft.com> wrote in message
> > news:D5F8D505-BC13-4F20-887A-62BC1BF2A669@.microsoft.com...
> > > how do i filter any expression in the data region
> > > e.g. i want all users for just New York?
> > > how to apply that filter condition in the expression in data region?
> >
> >
> >|||i want to count the same thing
but count(nuserid) which is userid
in a text box in table
how will the box understand using this query
=Count( iif(Fields!City.Value = "New York", 1, Nothing), "DataSet1" )
that i want to count userid?
i dont have any parameters in my report
"Robert Bruckner [MSFT]" wrote:
> Sorry, but based on your questions I thought you want to filter data.
> However, you actually want to calculate some aggregates. Try this
> expression:
> =Count( iif(Fields!City.Value = "New York", 1, Nothing) )
> The count aggregate also takes a scope parameter, so depending on where you
> use this expression in the report, you might need to add a scope for the
> aggregate (e.g. the dataset name or containing reportitem name). E.g.:
> =Count( iif(Fields!City.Value = "New York", 1, Nothing), "DataSet1" )
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Raj" <Raj@.discussions.microsoft.com> wrote in message
> news:7031923E-DD39-4A21-9721-F9CEF898D707@.microsoft.com...
> > hi robert
> > i am still confused
> > i have a field but i dont want to use filter on the fields.city.value
> > i want to count users where city is new york
> > 1 field in my table is userid
> > 1 field is their residing city
> > what shall i do?
> >
> > "Robert Bruckner [MSFT]" wrote:
> >
> > > See BOL:
> > >
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rshowto/htm/hrs_designer_v1_3diq.asp
> > >
> > > Example:
> > > Filter expression: =Fields!City.Value
> > > Operator: => > > Value expression: ="New York" or just New York (because it is a string)
> > >
> > > --
> > > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> > >
> > > "Raj" <Raj@.discussions.microsoft.com> wrote in message
> > > news:D5F8D505-BC13-4F20-887A-62BC1BF2A669@.microsoft.com...
> > > > how do i filter any expression in the data region
> > > > e.g. i want all users for just New York?
> > > > how to apply that filter condition in the expression in data region?
> > >
> > >
> > >
>
>

How to filter a table with an "OR" condition

I'd like to set the Filters in the Filters tab of the Table Properties dialog to say:

=Fields!WT_TO.Value > 0 OR

=Fields!WT_TO_PREV.Value > 0

but teh And/Or column is permanently disabled, and its sticking in a default value of AND

what's up with that?

Hello,

I don't think there is a way to change the AND/OR, and the only way to get an OR is to have the exact same expression in your filter.

Try this instead:

Expression: =Fields!WT_TO.Value > 0 or Fields!WT_TO_PREV.Value > 0

Operator: =

Value: =True

Hope this helps.

Jarret

|||your technique works great - i'm surprised they bother with the multiple filters and the and/or column since you can't really use it and all you really need is a single expression. Anyway, thanks!|||

"I don't think there is a way to change the AND/OR, and the only way to get an OR is to have the exact same expression in your filter."

What about changing it directly in the XML? Is that a possibility?

The need for OR is obvious.

Maybe there's a similar solution for my situation--but the OR option is really it.

I need to be able to show some subset of the list of states (from the US) based on the selection from a multivalue parameter, "OR" the TOTALS row.

Suggestions?
|||I figured this out myself, thank you.

OR is only used if the Operator for the filter is an equal (=) sign. Otherwise, it's AND.

They assume that programmers/developers are retards and can't figure out the logic for themselves.

God forbid that I should have multiple, dynamic options to compare--at the same time that a static value is also a possibility.
|||OMG that sucks. still, lotta good stuff is SSRS Wink