Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Adding records based on if a field does not match itself?
dlmallard
<p>All, I need help.</p>
<p> </p>
<p>We have a report that shows services provided for clients and the authorization (Auth) code for the services.</p>
<p>I'm trying to update the report to also show selected fields if the services were not provided under the authorization codes that exist for the client. Our goal is to determine where services are being provided that we aren't getting paid for (because they are not authorized). There is a challenge in that each client has his/her own Auth codes and there can be more than one for any given client.</p>
<p> </p>
<p>How do I code to pull in all auth codes and then look through that list to check records NOT IN that list?</p>
<p> </p>
<p>Thank you kindly for any help you can provide!</p>
<p> </p>
<p>D,</p>
<p> </p>
Find more posts tagged with
Comments
wwilliams
<p>Is this a SQL database? Are the valid codes in a separate table ...need more info.</p>
dlmallard
<blockquote class="ipsBlockquote" data-author="wwilliams" data-cid="132272" data-time="1416945844">
<div>
<p>Is this a SQL database? Are the valid codes in a separate table ...need more info.</p>
</div>
</blockquote>
<p> </p>
<p>Thanks WW, I am using the BIRT with a DB2 database.</p>
<p> </p>
<p>The valid codes are in the same table as some of the fields. I wand to check those valid codes against themselves .. so for instance if a given user has auth code '12345' , '23456', & '34567' assigned to them (which are valid), I need a way to check if they also were given service under any other auth code (or no code at all) <u>those will be invalid </u>. </p>
<p> </p>
<p>So, I need a way to run a second pass of the auth code field to check it against itself or somehow place all of the codes for a given user into an array so that, at each user, I suppose I could query the array to see if the user had service under any other auth code besides the valid ones. If that condition is found, I want to write additional fields outlining the invalid service event (those fields will be pulled from a different table.)</p>
<p> </p>
<p>Thanks for your help, I'm VERY new to BIRT.</p>
wwilliams
<p>"The valid codes are in the same table as some of the fields. I wand to check those valid codes against themselves .. so for instance if a given user has auth code '12345' , '23456', & '34567' assigned to them (which are valid)"</p>
<p> </p>
<p>If they exist in the same table how do you know if those codes are valid\assigned to them?</p>
<p>I would think, one table would hold the service records and another for the client with auth codes or something along that line.</p>
<p>I am sorry it still doesn't make sense, but sometimes I am a bit dense.</p>
dlmallard
<p>WW, Thanks again,</p>
<p> </p>
<p>Sorry I wasn't clear. The valid Auth codes are on one table. We know these are valid by simply being on the table. The auth codes for each service event are on a separate table with all of the service event info. I want to run a report which shows all of the valid service codes THEN show a list of the service records that have an event service code that does not match any of the valid service codes for a given client.</p>
<p> </p>
<p>So, I'm thinking I have to run a query to obtain all of the valid auth info for a given client, then run a second query to check all of the service events for that client that have an auth code that is different than the array of valid auth codes. I just don't know how to do that in BIRT (how to add selected info into an array..AND how to run a second SQL query)</p>
<p> </p>
<p>I thank you again kindly for your help!!! </p>
wwilliams
<p>OK, so we have a Service table, which should include a client column as an authorization column.</p>
<p>The second table (Client) will have a client column and the associated authorization codes in another column e.g. "authcodes".</p>
<p>So the relationship between the two tables will be the client column and then the authcodes?</p>
<p>So the result set you want will be those where the service record authcode is null or does not match those authcodes in the second table (Client).</p>
<p> </p>
<p>this sound correct?</p>
dlmallard
<p>WW,</p>
<p> </p>
<p>The relationship between all tables is a client number.</p>
<p> </p>
<p>One table ... "Master" has all info about the client (name, gender, address..etc... along with their client number)</p>
<p>Another table..."AuthTBL" has all of the valid auth codes (some other info) and the associated client number.</p>
<p>A Third table "Services" has all of the service event info including an auth code recorded for that specific event which includes the client number the service was for.</p>
<p> </p>
<p>The 1ST result set should include information regarding the client and their VALID AuthTBL auth codes.</p>
<p>The 2ND result set should include those service records where the Services authcode is null or does not match the VALID AuthTBL authcodes for that client.</p>
<p> </p>
<p>Thanks!</p>
wwilliams
<p>Try something like this</p>
<p> </p>
<p>SELECT Service.id, Service.authcode, authcode.authcode,Master.client<br>
FROM (Service LEFT JOIN authcode ON (Service.client = authcode.client) AND (Service.authcode = authcode.authcode))<br>
LEFT JOIN Master on Master.client = Service.client<br>
WHERE ((authcode.authcode) Is Null);<br>
</p>
dlmallard
<p>Thanks for your help. I found a way to create the report and provided the needed data without going to extra step.</p>