Mass Update Table Records (With Conditions) From Loaded Variables

Hi there -

Background:
Operator calculates a set of statistics from the total sample size & the respective measurements within sample set of a given lot/batch number. Has to manually load each set of calculations into the selected Sample ID # (Bottom Right).

Table Records ID Nomenclature:
'[Product Code] ‘-’ [Lot Number] ‘-’ [Defect Category] ‘-’ [Sample ID #]

Current Operation:

  1. Operator Selects Defect Category to find calculations for from the Defect Classification Table (Upper Right)
  2. Selects a Sample ID Record from the Inspection Table Record (Bottom Right)
  3. Repeats Calculate to store calculations for each individual sample ID # for the entire sample size.

Is there a way to batch edit multiple inspection records based currently-loaded variables?

Tulip Support gave me this, but I do not want to pull from a .CSV.

import requests
import csv
import json
import time

#FACTORY = cooper-usa.tulip.co
FACTORY = ''cooper-usa.tulip.co
#AUTHORIZATION = ''Basic …==
AUTHORIZATION = ‘’'Basic… ==
CSV_FILE = ‘’ #CSV local file name
#TABLE_ID = XooSfizhcWqiMnTxx
TABLE_ID = ''XooSfizhcWqiMnTxx

endpoint = FACTORY + “/api/v3/tables/” + XooSfizhcWqiMnTxx
response = requests.get(endpoint, headers = {‘Authorization’: AUTHORIZATION})
print(response.json())

failedIDs =
success_count = 0
failure_count = 0
endpoint = FACTORY + “/api/v3/tables/” + TABLE_ID + ‘/records’
with open(CSV_FILE, encoding=‘utf8’) as csv_file:
csv_reader = csv.reader(csv_file, delimiter=‘,’)
line_count = 0
for row in csv_reader:
if line_count > 0: # Ignore header rows
# Column mapping should follow the format of ‘COLUMN_ID’: row[COLUMN_INDEX]
# Where COLUMN_ID is defined by the Tulip Table schema i.e. abcde_test
# and COLUMN_INDEX is the column number of the CSV (0-indexed)
column_mapping = {
‘id’ : row[2],
# Example ’xyz_part’ : row[3],
#’ xyz_description’ : row[4],

        }
        columns = json.dumps(column_mapping)
        id = row[2]
        print(column_mapping) 
        response = requests.post(endpoint, headers = {'Authorization': AUTHORIZATION}, data=columns, verify=False)
        if response.status_code != 201:
            print('Posting row {} with id {}, failed with {} response'.format(line_count, id, response))
            failedIDs.append(id)
            failure_count += 1
        else:
            print('Modify successful for ' + id)
            success_count += 1
        time.sleep(0.2)
    line_count += 1

print(failedIDs)

Hey @gentleboyjones -

Pulled your API Key (the “Basic …” text)from your example just to make sure your data is safe.

What are the chances you can stop by one of the three office hours sessions I hold every week to work through this one? Struggling a little bit to understand exactly the usecase, but i’m sure we can throw together something live on one of these sessions!
Tuesday 10AM EST - Meet - New User Office Hours

Thursday 11AM EST - Meet - General Office Hours

Thursday 4PM EST - Meet - New User Office Hours

Thanks!
Pete