Look up function inside IF condition visibility - SSRS - if-statement

I have a SSRS report with one tablix and i want to hide the tablix based on a condition. I am using two datasets there. The tablix contains dataset1 records. I want to check the dataset2 with Pno and if then only need to display that Pno in tablix.
Dataset1
Pno Group
1 A
2 S
3 D
4 F
Dataset2
Pno Supply Demand Group
1 A
3 D
5 B
6 R
Now I want to display only
Pno Group
1 A
3 D
I am using the following condition.
=IIF(Lookup(Fields!Group.Value, Fields!Pno.Value, Fields!Pno.value, "Dataset2"), True, False)
But it doesn't filter the records. Can anyone help me to solve this?
Thanks in advance...

I think that you may just have your Lookup parameters mixed up. Try this:
=IIF(Lookup(Fields!Pno.Value, Fields!Pno.value, Fields!Group.Value, "Dataset2"), True, False)
One step further:
=IIF(Lookup(Fields!Pno.Value, Fields!Pno.value, Fields!Group.Value, "Dataset2") <> "", True, False)
In a Lookup, the first 2 parameters are the fields that need to match, the third is the value being returned, the fourth is the dataset being queried.

Try using this expression in for hidden in the Row visibility window:
=IIF(ISNOTHING(ReportItems!Group.Value),True,False)
ReportTems!Group is the name of the cell where you are using the Lookup function, replace Group by the actual name of the cell:
=Lookup(Fields!Group.Value, Fields!Pno.Value, Fields!Pno.value, "Dataset2")
If your cell has a different name select the cell and press F4 to see the properties window, look for the name property.
It will produce:
Let me know if this helps.

Related

How do i can create IR in apex oracle based on different table and column

IR based on PL/SQL Function Body returning SQL Query.
How do i can create Interactive reports based on multiple table and Deferent column name.
Exp :-
Select list item return three value
1 or 2 or 3
And the function return query basen on select list value
when Value equal 1
Select name, satate, country_id from cities
when value equal 2 Return
Select country, id from country
when value equal 3 Return
Select ocean,oc_id,from oceans
The three query return different column name and value.
Ok firstly, your question is poorly written. But from what I gather, you want an SQL query that returns different things based on an input.
I dont think you even need a plsql function body for this.
Simply do something like this:
SELECT * FROM
(SELECT name as name,
state as state,
country_id as id,
1 as value
FROM cities
UNION ALL
SELECT country as name,
NULL as state,
id as id,
2 as value
FROM country
UNION ALL
SELECT ocean as name,
NULL as state,
oc_id as id,
3 as value
FROM oceans)
WHERE value = :input_parameter_value;
Because if you are trying to display a variable number of columns and constantly changing their names and such. You are gonna have a bad time, it can be done, as can everything. But afaik its not exactly simple
No objections to what #TineO has said in their answer, I'd probably do it that way.
Though, yet another option: if your Apex version allows it, you can create three Interactive Report regions on the same page, each selecting values from its own table, keeping its own column labels.
Then create a server condition for each region; its type would be Function that returns a Boolean and look like
return :P1_LIST_ITEM = 1;
for the 1st region; = 2 for the 2nd and = 3 for the 3rd.
When you run the page, nothing would be displayed as P1_LIST_ITEM has no value. Once you set it, one of conditions would be met and appropriate region would be displayed.

SSRS grouping all but one field

I have a query that all the fields are the same except for one. I want to group my SSRS report so that it has "blanks" for all the duplicated fields and only show the "different" one WHEN there is a "duplicate" record.
For instance:
Case Number PersonID Narrative
123 1 xxx
345 3
456 9 ABCD
KFL
So record 1 has a narrative and only one record. Record 2 has no narrative. Record 3 & 4 are the same case, same person, two different narratives.
I thought by grouping by all the other fields that I would achieve these results but that is not working, I still get the 456 and 9 on my 4th record when I have grouped by the other fields.
How can I get just the narrative to display when all the other fields in that record match the previous record?
Thanks,
Leslie
You can see my answer for:
How to get only one value in SSRS?
You have similar situation. You need to use expression for first 2 columns:
=IIF(Fields!CaseNumber.Value = Previous(Fields!CaseNumber.Value), "", Fields!CaseNumber.Value)
=IIF(Fields!PersonID.Value = Previous(Fields!PersonID.Value), "", Fields!PersonID.Value)
This will hide all repeating "Case Number" and "PersonID".
Don't forget to replace "CaseNumber" and "PersonID" with proper column names in DataSet.

Compare column value against list of regex values stored in another table and update accordingly

I am new to Oracle programming.
I want to check the "msg" value of "Table1" against the "regex" values from "Table2".
If the regular expression matches as such, I want to update the respective "regex_id" in "Table1".
Usual query: SELECT 'match found' FROM DUAL WHERE REGEXP_LIKE('s 27', '^(s27|s 27)')
Table1
MSG REG_EXID
Ss27 ?
s27 ?
s28 ?
s29 ?
Table2
REGEX REG_EXID RELEVANCE
^(s27|s 27) 1 10
^(s29|s 29) 2 2
^(m28|m 28) 3 2
^(s27|s 27) 4 100
Taking the newly added "relevance" into account, with Oracle 11g you could try along
UPDATE Table1 T1
SET T1.reg_exID =
(SELECT DISTINCT
MAX(reg_exID) KEEP (DENSE_RANK FIRST ORDER BY relevance DESC) OVER (PARTITION BY regex)
FROM Table2
WHERE REGEXP_LIKE(T1.msg, regex)
)
;
See SQL Fiddle.
You could work along
UPDATE Table1
SET reg_exID = (SELECT reg_exID FROM Table2 WHERE REGEXP_LIKE(Table1.msg, regex));
Please keep in mind:
None of your current sample records will be updated as REGEX are case sensitive.
The above UPDATE will fail, if more than a single REGEX does match.
You could rewrite the current REGEX expressions along "^m ?28".
See it in action: SQL Fiddle (With some data added to actually show the effect.)
Please comment if and as clarification/adjustment is required.

Searching for unmatched ntheames when comparing spreadsheets

In one spreadsheet I have 3 columns with a first and last name of a person combined. In the 2nd spreadsheet, I have column a = first name and column b = last name.
I want to know which names in spreadsheet one cannot be found in spreadsheet two. I also need to verify the data to make sure that the formula was accurate on finding the correct lookup.
Do I have to combine my columns in spreadsheet 2 to make the first and last name in the same column to make this work?
Which formula would you use for either scenario?
Use this:
=ISNA(MATCH($A1&" "&$B1,Sheet2!$A:$A,FALSE)))
Where (in order):
A1 is the first name column in Sheet1
B1 is the last name column in Sheet1
Sheet2 is the sheet that has the data stored as names separately
$A:$A is the rows that have the two names together
FALSE is because it's an exact match
This will return FALSE if the element does not exist, and TRUE if it does
You can also use:
=VLOOKUP($A1&" "&$B1,Sheet2!$A:$D,3,FALSE)
If you want to retrieve data for a match.
Finally, if you need to do your lookups the other way, take a look at this thread for some ideas on how to split the string into two pieces.

I need serious help in changing the vaue of a column within the same column by going 2 rows up and changing the value

I am a DBA of 7 months so please bear with me. I am needing to write a code that will find a particular ProductIdentifier. When this particular ProductIdentifier is found, 1. I need to grab this ProductIdentifier. 2. I need to go 2 rows up and place that ProductIdentifier in the field that is 2 rows above it.
Here is my code(everything is sorted properly already in this table)
SELECT
SipID,
SaleInvoiceID,
AssociationNumber,
Priority,
TotalPrice,
TotalCost,
SerialNumber,
ContractNumber,
ActivatedThroughPAW,
DateCreatedatMidnight,
ReceivedDate,
InvoiceIDByStore,
Location,
ProductIdentifier,
Description,
ShortDescription,
CategoryName,
RevenueStreamID,
RevenueType
FROM REVISEDTABLE.
I will better show you what needs to be done ![enter image description here][1]
ProductIdentifier
AWUPG2001RGP -- replace this product identifier with the 'AWRPNS000%'
POSC0021PRW
AWRPNS000343 --take this product identifier
What I need for this code to do is this: whenever I find any ProductIdentifier like 'AWRPNS000%', I need for the query to take this and go 2 rows up and replace whatever ProductIdentifier is in this with 'AWRPNS000%'. I then need to insert the results into a table. I believe the best thing to do is to select the ProductIdentifier row again and give it an alias. This will be the row that I need to transform. I can then do a comparison to see if things worked out. I do not know how to write the code to do the actual grabbing of the ProductIdentifier and going up 2 rows and replacing it, so any help or input would be greatly appreciated.
So what does two rows up mean. Why is it two rows up.
e.g.
ID Class Type Date
1 1 2 20/12/2012
2 1 2 21/12/2012
3 1 2 22/12/2012 *
ie yes ID is two rows up but that's because The records are in ID and date order and there are at least three of them.
If you can come up with that rule e.g.
Select * From SomeTable Where Class = 1 and Type = 2 And Date = 20/12/2012
Then all your problems go away...