SSRS 2008 row visibility issue - reporting-services

I am facing following scenario :
I have two values A and B and I need to Hide and show it based on ssrs expression.
My Conditions :
If A = 1 and B = 1 show row
If A = 1 and B = 0 Show row
If A = 0 and B = 1 Show row
If A = 0 and B = 0 Hide Row
(I have tried using AND, OR, XOR, AndAlso, OrElse but it is not working.)
(Problem arises because SSRS shows when output is false and hides when output is true)

Select the table detail row (or group row depending your table) and in the Visibility set the hidden expression like below
= ( Fields!A.Value = 0 AND Fields!B.Value = 0)

Related

How do I hide columns in SSRS with TWO conditions?

I've got a report with a ColumnA that needs to be hidden if to specific values for parameters are met.
Join(Parameters!vExclude.Value,",").Contains(0)=True
and
Parameters!vType.Value = 1
I've tried
= Join(Parameters!vExclude.Value,",").Contains(0)=True and Parameters!vType.Value = 1
= iif(Join(Parameters!vExclude.Value,",").Contains(0)=True and Parameters!vType.Value = 1, true, false)
and it doesn't produce an error, yet one condition is always ignored.
Any suggestions?

Multiple WHERE conditions using AND => No query result

I have a table with a few thousand entries. And My purpose is to select all entries from all versions that correspond to a given one. And the resulted entries must correspond exactly to the given entry.
But somehow, the SQL query does not work. The original project uses Access 2007. But I have tried also in MySQL and no success
I put here the sql query, but I also made a SQL fiddle:
SELECT
idvalue,
idtag,
iddevice,
idversion,
idtext,
description,
idaccess,
defaultvalue,
minimumvalue,
acceptedvalue,
maximumvalue,
outofrangevalue,
iddatatypepn,
iddatatypeopc,
size,
idresolution,
idunit,
idaccuracy,
enumerationvalues,
comments,
remanentvolatile,
storedatpn,
storedatmain,
`generated`,
edittime
FROM
SomeValues
WHERE
idtag = 2 AND iddevice = 1
AND idtext = 433
AND description = 'Input voltage (AC)'
AND idaccess = 12
AND defaultvalue IS NULL
AND minimumvalue =0
AND acceptedvalue = 5300
AND maximumvalue = 10050
AND outofrangevalue = 11000
AND iddatatypepn = 2
AND iddatatypeopc = 19
AND size = 2
AND idresolution = 2
AND idunit = 1
AND idaccuracy = 2
AND enumerationvalues IS NULL
AND comments IS NULL
AND remanentvolatile IS NULL
AND storedatpn = FALSE
AND storedatmain = FALSE
AND `generated` = TRUE
Fiddle: here
Can you please explain what is wrong with the sql query?
The result should be those 3 entries from the fiddle table.
And yes, I must use all the conditions from the "Where" clause, since the entries can match 90% but also have small differences
You have problem in line:
AND description = 'Input voltage (AC)'
change it to:
AND description = '"Input voltage (AC)"'
and everything will works.
Problem lies in the fact that you searched for text Input voltage (AC) instead of "Input voltage (AC)" (how is stated in column description).

how to sum after iff condition in ssrs?

I want to sum all the values of the column, using if condition same as the column expression:-
The Expression of the normal column:-
iif(Fields!mcount.Value <> 0 And Fields!TaxCode.Value = 1 ,Fields!InputAmnt.Value,0)
The Expression to sum, I used 2 codes and the same result "#Error" appeared in both cases
sum(iif(Fields!mcount.Value <> 0 And Fields!TaxCode.Value = 1 ,Fields!InputAmnt.Value,0))
and
iif(Fields!mcount.Value <> 0 And Fields!TaxCode.Value = 1 ,sum(Fields!InputAmnt.Value),0)
any help ?
Try adding VAL from the InputAmnt field. See below expression.
=SUM(iif(Fields!mcount.Value <> 0 And Fields!TaxCode.Value = 1 ,VAL(Fields!InputAmnt.Value),0))

Update column depending on other column by calculation

seems like a stupid question...
I have a mysql table where I want to modify column A to a number 0 or 1 depending on the condition of another column B
So: if( B > 500 ) A = 1 ELSE A = 0
Column A = INT
Column B = DOUBLE
How do you do something like this in sql?
Thanks,
Erik
Try the following statement,
UPDATE tableName
SET A = (B > 500)
SQLFiddle Demo
(B > 500) is a boolean arithmetic in mysql which returns 1 and 0 for true and false , respectively.
You can also use CASE for much more RDBMS friendly,
UPDATE tableName
SET A = CASE WHEN B > 500 THEN 1 ELSE 0 END

Default value 0 to prevent suppression of sub-report

I'm fairly new to ssrs and I'm trying to creat a report with a sub-report which e.g. returns 3 fields / columns.
When I export this to excel it reads
A1 B1 C1
100 50 100
When there's no data / dataset returns no records all cells A to C are merged to one cell?
Which makes processing the file a real pain...
I've tried the norowsmessage but then I get one value in the merged cells.
Can't remember I had this with Crystal Reports?
Is there something I can do to always return the sub-report with the 3 columns in it so my layout is retained?
Thanks in advance,
Mike
I've fixed it by using a Union statement in my SQL string:
SELECT - SUM(QTY) AS EXPR1, - SUM(ENTEREDVALUE) AS EXPR2, - SUM(LINEAMOUNTMST) AS EXPR3
FROM DBS_SUPERVISOR.STOCKTRANS
WHERE (DATASET = 'CAT') AND (ITEMNUMBER = :myitem) AND (DATEPHYSICAL >= :VanDatum) AND (DATEPHYSICAL <= :TotDatum) AND (STREFERENCE = 0) AND
(DCTYPE = 1) AND (STATUSOUTFLOW = 1) AND (DCGROUP = 'GROUPX')
GROUP BY ITEMNUMBER
UNION ALL
SELECT 0 AS EXPR1, 0 AS EXPR2, 0 AS EXPR3
FROM SYS."DUAL"
WHERE (NOT EXISTS
(SELECT QTY AS EXPR1
FROM DBS_SUPERVISOR.STOCKTRANS STOCKTRANS_1
WHERE (DATASET = 'CAT') AND (ITEMNUMBER = :myitem) AND (DATEPHYSICAL >= :VanDatum) AND (DATEPHYSICAL <= :TotDatum) AND (STREFERENCE = 0)
AND (DCTYPE = 1) AND (STATUSOUTFLOW = 1) AND (DCGROUP = 'GROUPX')))
This way if the top part doesn't return a row the bottom part will return 3 columns with 0
Regards,
Mike