Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 20764

SSRS 2012 - Issue when using 2 variable columns with "Join LookupSet" Logic

$
0
0

Greetings,

As a newbie to SSRS 2012, I was very pleased to find the logic in a variable to help turn multiple rows into a single field on my report.

For example, I wanted to place this data in one cell on my report and the SSRS 2012 variable logic worked perfectly:

= Join (LookUpSet (Fields!PATIENT.Value, Fields!PATIENT.Value, Fields!MEDICATION.Value, "DataSet1"), ",")

Before this Code (3 rows on report fopr 1 patient):

PATIENT   MEDICATION

John Doe     Aspirin

John Doe     Tylenol

John Doe     Tums

John Doe     Cortizone

John Doe     Bactrim

AFTER CODE/VARIABLE (only 1 row per patient when I use this variable...Fantastic!)

PATIENT    MEDICATION

John Doe      Aspirin, Tylenol, Tums, Cortisone, Bactrim

The Problem started when I attempted to add a second variable to the report using the same logic.

= Join (LookUpSet (Fields!PATIENT.Value, Fields!PATIENT.Value, Fields!PROBLEM_LIST.Value, "DataSet1"), ",")

PATIENT      MEDICATION                                     PROBLEM_LIST

John Doe       ,,Aspirin, Tylenol, Tums, Cortizone            Short of Breath, Heart Failure,,,

Do you see the problem ? (The extra commas preceding Medication and the extra comas following the Problem list)

I understand why they are happening but I need to get rid of them in the report.

They are happening because at the query level, the data looks like this (below) and the comas are simply place holders for the null values the variable sees in the SQL matrix below

DATA SET QUERY RESULTS  (The SQL query aggregates these columns so that the dataset presents like this from the query)

Patient      Medication         Problem_List

John Doe     Aspirin               Short of Breath

John Doe     Tylenol               Heart Failure

John Doe     Tums

John Doe     Cortisone

John Doe     Bactrim

How do I resolve this to get the correct presentation on the report (no extra coma placeholders)? I seem to be so close but am now wondering if I should dump the variable solution to creating this array and instead learn how to do a function that might accomplish this instead?  Any or suggestions here would be much appreciated!

Thanks!


Viewing all articles
Browse latest Browse all 20764

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>