def add_Salesforce_indices(combined_nsc):
    ''' Adds the Salesforce names for alumni and colleges using the student
    id "YOUR UNIQUE IDENTIFIER" from NSC and using the NCES code for college.
    Will use "N/A" for any alumnus/alumnae or college not found in the lookup'''
    # First check whether the user would prefer to add from Salesforce API
    # calls directly or via file upload
    choices = [
        'Grab directly from Salesforce',
        'Import as CSV files (see README for details)'
    ]
    response = tktools.get_buttons_answer(
        choices,
        'How would you like to get the SF IDs for alumni and colleges?')

    # Once the user responds, generate a dictionary lookup for both fields
    if response == choices[0]:  # user selected 'Grab directly from Salesforce'
        alumni_dict, college_dict = import_ids_from_salesforce()
    else:  # user wants to enter the info as a set of CSV files
        filenames = {
            'alum': [
                'alumniNames.csv',
                'Alumni names file (two columns: Your ID/SF ID)', 'r'
            ],
            'coll': [
                'collegeNames.csv',
                'College names file (two columns: NCES ID/ SF ID)', 'r'
            ]
        }
        tktools.get_filenames(filenames)
        alumni_table = tt.grab_csv_table(filenames['alum'][0])
        alumni_dict = tt.create_dict(alumni_table[1:], 0, 1)
        college_table = tt.grab_csv_table(filenames['coll'][0])
        college_dict = tt.create_dict(college_table[1:], 0, 1)

    # Now that we have a dictionary for both, generate the two new columns
    college_ids = []
    alumni_ids = []
    for row in combined_nsc.rows():
        try:
            college_ids.append(college_dict[row[combined_nsc.c('NCES ID')]])
        except:
            college_ids.append('N/A')
        try:
            alumni_ids.append(alumni_dict[row[combined_nsc.c('sId')]])
        except:
            alumni_ids.append('N/A')

    # Finally, add the new columns back to the master table
    combined_nsc.add_column('College__c', college_ids)
    combined_nsc.add_column('Student__c', alumni_ids)
def add_Salesforce_indices(combined_nsc):
    """ Adds the Salesforce names for alumni and colleges using the student
    id "YOUR UNIQUE IDENTIFIER" from NSC and using the NCES code for college.
    Will use "N/A" for any alumnus/alumnae or college not found in the lookup"""
    # First check whether the user would prefer to add from Salesforce API
    # calls directly or via file upload
    choices = ["Grab directly from Salesforce", "Import as CSV files (see README for details)"]
    response = tktools.get_buttons_answer(choices, "How would you like to get the SF IDs for alumni and colleges?")

    # Once the user responds, generate a dictionary lookup for both fields
    if response == choices[0]:  # user selected 'Grab directly from Salesforce'
        alumni_dict, college_dict = import_ids_from_salesforce()
    else:  # user wants to enter the info as a set of CSV files
        filenames = {
            "alum": ["alumniNames.csv", "Alumni names file (two columns: Your ID/SF ID)", "r"],
            "coll": ["collegeNames.csv", "College names file (two columns: NCES ID/ SF ID)", "r"],
        }
        tktools.get_filenames(filenames)
        alumni_table = tt.grab_csv_table(filenames["alum"][0])
        alumni_dict = tt.create_dict(alumni_table[1:], 0, 1)
        college_table = tt.grab_csv_table(filenames["coll"][0])
        college_dict = tt.create_dict(college_table[1:], 0, 1)

    # Now that we have a dictionary for both, generate the two new columns
    college_ids = []
    alumni_ids = []
    for row in combined_nsc.rows():
        try:
            college_ids.append(college_dict[row[combined_nsc.c("NCES ID")]])
        except:
            college_ids.append("N/A")
        try:
            alumni_ids.append(alumni_dict[row[combined_nsc.c("sId")]])
        except:
            alumni_ids.append("N/A")

    # Finally, add the new columns back to the master table
    combined_nsc.add_column("College__c", college_ids)
    combined_nsc.add_column("Student__c", alumni_ids)
        arg_dict['out'] = [args.out, out_help, 'w']
    
    if not args.db:
        if args.csv:
            args.db = False
        else:
            args.db = tktools.get_yes_no(
                'Get database info directly from Salesforce?')

    if not args.out and not args.db:
        arg_dict['enr'] = [args.enr, enr_help, 'r']
        arg_dict['con'] = [args.con, con_help, 'r']
        arg_dict['acc'] = [args.acc, acc_help, 'r']
        
    if arg_dict:
        tktools.get_filenames(arg_dict)
        if 'con' in arg_dict: args.con = arg_dict['con'][0]
        if 'acc' in arg_dict: args.acc = arg_dict['acc'][0]
        if 'enr' in arg_dict: args.enr = arg_dict['enr'][0]
        if 'out' in arg_dict: args.out = arg_dict['out'][0]

    if args.summary:
        by_hs = False
    else:
        by_hs = True

    if args.db:
        infiles = None
    else:
        infiles = (args.con, args.acc, args.enr)
    main(infiles,args.out,args.hs, by_hs, args.verbose)
    parser.add_argument('-deg', dest='deg', action='store', help=deg_help,
            default='nsc_inputs/degreelist.csv')
    out_help='Output filename (csv)'
    parser.add_argument('-out', dest='out', action='store', help=out_help,
            default='import_nsc_output.csv')
    days_help='Number of days allowed between enrollments'
    parser.add_argument('-days', dest='daysgap', type=int, help=days_help)
    effdate_help='Date to use for NSC file run (MM/DD/YYYY)'
    parser.add_argument('-date', dest='effdate', help=effdate_help)
    args = parser.parse_args()
    # The following dict format is expected by tktools.get_filenames
    arg_dict = {    'nsc':  [args.nsc, nsc_help, 'r'],
                    'sch':  [args.sch, sch_help, 'r'],
                    'deg':  [args.deg, deg_help, 'r'],
                    'out':  [args.out, out_help, 'w'],
                    }
    if args.nsc is None: #Assume the user needs to be queried with a window
        tktools.get_filenames(arg_dict)
    if args.daysgap is None:
        args.daysgap=131
    if args.effdate is None:
        args.effdate='12/01/2014'
    main(   arg_dict['nsc'][0],
            arg_dict['sch'][0],
            arg_dict['deg'][0],
            arg_dict['out'][0],
            args.daysgap,
            args.effdate
            )
    s = input('----(hit enter to close)----')