Sunday, March 11, 2012

Conditional Split

I am using a conditional split to evaluate the condition below. It should only send records to my SQL Server database if the PatientZip matches one of the eight below and the PatientCity is not Wichita Falls (you wouldn't believe how bad this is mispelled sometimes). I checked the output table and it has all records for the zipcodes below both matching and non-matching the cityname of Wichita Falls. The table should not have entries for records with the cityname of Wichita Falls. Do I have the code correct or could I have missed something?

LTRIM(PatientCity) != "Wichita Falls" && (PatientZip == "76301" || PatientZip == "76302" || PatientZip == "76305" || PatientZip == "76306" || PatientZip == "76307" || PatientZip == "76308" || PatientZip == "76309" || PatientZip == "76310")

One thing to look at is if you're sending the correct output from the Conditional Split to your destination.

Another thing is that you may want to RTRIM to catch trailing spaces instead of just LTRIMming to catch leading spaces.

|||

Thanks for the replay Matthew. I added the RTRIM as you suggested. My output name for my condition is "Bad City Name" and the default output name is "Correct City Name". I connected each output to different SQL Server tables that are exactly the same except for the table names. The Bad City Name output table is still being populated with data that is actually correct (city = "Wichita Falls" and is in the zipcodes listed above). The Correct City Name output table is being populated with any and all entries except (city = "Wichita Falls" and is in the zipcodes listed above).

As a check; I just ran the following query against the source database after replacing the logical operators with their SQL equivalents and the double quotes (") with single quotes (') and the query returned exactly what I am attempting to achieve with Integration Services.

select PatientName, PatientCity, PatientState, PatientZip

from ampfm.rpt_PatientDemographics

where LTRIM(RTRIM(PatientCity)) != 'Wichita Falls'

and (PatientZip = '76301' or PatientZip = '76302'

or PatientZip = '76305' or PatientZip = '76306'

or PatientZip = '76307' or PatientZip = '76308'

or PatientZip = '76309' or PatientZip = '76310')

I am at a loss as to why the Integration Services routine is not returning the correct row data. I must have something designed incorrectly. This is the first of several similar packages I am creating as the cornerstone to our audit process, but I need the correct data in the output (reporting) tables first. Please advise anything you feel may be in error that I can check.

Thanks!

|||

Have you tried putting a data viewer on the path going into and out of the conditional split? It might help to see what data you are getting in, and what data is on which path going out... (perhaps you have your tables flipped on your destinations, etc)

|||

I appreciate your post. Yes, I had earlier added data viewers and they showed the same data that querying the output tables were showing. I have everything set correctly as far as I can tell, it just isn't working as expected.

I finally deleted the conditional split and went with a Lookup object using the query below and it is pulling the correct information and putting it in the correct output tables. I guess I'll try to tackle conditional split issues at another time.

select PatientName, PatientCity, PatientState, PatientZip

from ampfm.rpt_PatientDemographics3

where LTRIM(RTRIM(PatientCity)) <> 'Wichita Falls'

and LTRIM(RTRIM(PatientZip)) IN ('76301','76302',

'76305','76306','76307','76308','76309','76310')

Thanks to all who have responded.

No comments:

Post a Comment