Friday, March 9, 2012

Does Expression really work in the table's details ?

Hello all,

I had editted this post to ask a better question.

I had noticed that certain expressions won't work in details. Is this true ?
when I tried using an IIF expression, I always get a blank or an empty field even if it was a text.
could someone clarify this ? I don't know whether it is just me or is it a limitation.

Sincerely,
Bernard Ong

Hello Bernard,

Can you try this:

=IIF(Len(Fields!ID5_10) = 0, IIF(Len(Fields!ID2_5) = 0, "", Fields!ID2_5.Value), Fields!ID5_10.Value)

Hope this helps.

Jarret

|||

Hi Jarret,

Thanks for the reply. I used your expression, and it gave an error, stating that there was a type mismatch.
The fields value should be an Int, not a string.

First off, I want to apologize to any readers who might be confused by the question.

The scenario was teh following:-

I am trying to put a certain field into a textbox, depending on which field is missing. In this case, Fields!ID5_10 and Fields!ID2_5.
depending on the parameters that is being used, the report would either use id5_10 or id2_5.

I tried teh following expressions in the text box
=IIF(Fields!ID5_10.IsMissing, IIF(Fields!ID2_5.isMissing, "", Fields!ID2_5.Value), Fields!ID5_10.Value)
=IIF(Isnothing(Fields!ID5_10), IIF(IsNothing(Fields!ID2_5), "", Fields!ID2_5.Value), Fields!ID5_10.Value)

Which Ended up giving me a blank textbox.

Next I tried to put the following expression:-
=IIF(Fields!ID5_10.IsMissing,"Missing","Not Missing")
Which lo and behold, gave me "Missing" in the textfield (this is the result of using a report that only needs Id2_5 instead of id5_10)

So I figure, if that worked, why can't i try this ?
=IIF( Fields!ID5_10.IsMissing, Fields!ID2_5.Value, Fields!ID5_10.Value)
To my dismay, it didn't work, giving it a blank.

After Reading Robert's post about the the difference between IsNothing and IsMissing, I figure i would use the isMissing property in the details group to switch the two fields.
My expression was the following (using the expression in this post):-
=IIF(Fields!ID5_10.IsMissing, IIF(Fields!ID2_5.isMissing, "", Fields!ID2_5.Value), Fields!ID5_10.Value)

This didn't work, because it showed an empty or a blank string.
HOWEVER, There is a similar expression that I used in the table's footer, which is
=IIF(Fields!ID5_10.IsMissing, IIF(Fields!ID2_5.isMissing, "", Sum(Fields!ID2_5.Value)), Sum(Fields!ID5_10.Value))
Which surprisingly worked !!

I took the next step and put the following into the details:-
=IIF(Fields!ID5_10.IsMissing, IIF(Fields!ID2_5.IsMissing,"Missing","2_5 not missing"),"5_10 Not Missing")
Which give me a result stating in the textbox that "2_5 not missing"

So somehow, someway, my expression is correct, but not able to get the values out of the field ?

I am really at a lost here, and I am wondering whether there is a limitation of the table only able to hold ONE field and couldn't evaluate more than one fields at the same time ?

Sincerely,
Bernard Ong

|||

Hi to all,

here is an update of the expression I am using.

I tried the following:-

=IIF(Fields!ID5_10.IsMissing, IIF(Fields!ID2_5.IsMissing,"Missing", Fields!ID2_5.Value ), "5_10 missing")

Surprisingly, the textbox actually show the values of the Fields!ID2_5.value
I thought this was just a hiccup, and I decided to put the following expression
=IIF(Fields!ID5_10.IsMissing, IIF(Fields!ID2_5.IsMissing,"Missing", Fields!ID2_5.Value ), Fields!ID5_10.Value )
which is an exact copy of the expression I had used in a post earlier, and guess what ?

Nothing.... shows a blank textbox again.

I really don't know what is going on with this, and it is very finicky and confusing no matter what i do.

Hope someone could shed some light on this.
Sincerely,
Bernard Ong

|||

Have you checked the data associated with each record to make sure that something should show? I.E. - Show 3 textboxes in a row, the first two are the raw values, and the last is the expression?

Can you post some sample data that you are seeing this behavior on (for ID2_5 and ID5_10)?

Jarret

|||

Hi Jarret !

well i am off work at the moment, but I know for a fact that the data is where they are. (using the dataset, and executing the stored procedure)

These values are in count and they are in integer.

Sample Id2_5 values

567293

Sample id5_10 values

5567

I did tried the suggestion you had, and the results were the following:-

Textbox1: Fields!ID2_5.value
Textbox2: Fields!ID5_10.value
Textbox3: (expression from the previous post)

Values were

Textbox1: 567293
Textbox2: 5567
Textbox3: -blank-

Sincerely,
Bernard Ong

No comments:

Post a Comment