Created
March 14, 2012 17:16
-
-
Save ebot/2037992 to your computer and use it in GitHub Desktop.
Get List of EncounterNos, DocsType, and Dates from tag files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wKU | |
out = File.new 'delete.csv', 'w' | |
encounters = [] | |
doc_dates = [] | |
doc_types = [] | |
Dir.glob('*.tag').each do |tag| | |
input = File.new tag, 'r' | |
input.each_line do |line| | |
val = line.split(':')[1].strip | |
encounters << val if line.include?( 'Account' ) and (encounters.include?(val) == false) | |
doc_types << val if line.include?( 'DOC_VALUE' ) and (doc_types.include?(val) == false) | |
doc_dates << val if line.include?( 'DOC_DATE' ) and (doc_dates.include?(val) == false) | |
end | |
end | |
out << "WHERE EncounterNo in ('#{encounters.join( "', '" )}')\n" | |
out << " AND DocTypeName in ('#{doc_types.join( "', '" )}')\n" | |
out << " AND DocDateTime in ('#{doc_dates.join( "', '" )}')" | |
out.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment