need help on importing a .csv into two related tables (scripting help?)
I have a ninox.com database with two working tables: Contacts (to track association members) and Events (to track events to which those members are invited). The goal is to import members' attendance after each event, via .csv import. Tables Contacts and Events are correctly linked via a third table called RSVP. I have imported an updated .csv file to a temporary table called StagingImport (a Nioxus video suggested that approach, with a script to update the actual records from here). The first column in the table attached here shows the fields in StagingImports and their field names. The second column shows the fields that need to be updated in the Contacts table and their field names (some are slighly different). The third column shows the fields that need to be updated in Events, and their field names. When I started looking at Ninox's scripting docs I realized I was in over my head. I tried asking ChatGPT (yeah, I know) for a script for a "Process the CSV Import" Button, and needless to say it errors out. The attached doc contains the label info for each table and (on page 2) the script suggested by ChatGPT. I'd appreciate any help you can offer either in correcting the script, or if there's a better (simpler) approach.
62 replies
-
We made it!
The issue in your database came up because the 'Event ID' field in the StagingImport table was set to number data type. So, I changed it to a text field type.
Everything seems to be working as expected now. Are you happy with the final result?
Today, I learned how to add a newly created record to an array of selected records using code. I have to thank for his helpful contribution.
I've attached the updated version of your database.
Best wishes
-
Love to see the support of the community in support of doing the main coding.
-
Hi, - one more question if you don't mind. Is your script expecting the Attended field in the RSVP table to be a text field or a choice (yes/no) field? It's currently a yes/no field and seems only to be populating Yeses correctly.
The .csv file is either yes or blank, so I have this 'trigger after update' on the field:
if Attended := true then true else false end
Content aside
- Status Answered
- 2 days agoLast active
- 62Replies
- 88Views
-
4
Following