Query value 'null' error

  • Goal: I have set up a CSV loading tool for Firestore.

  • Steps: I have bulit the FileButton to upload to CSV and a table to display the data.

  • Details:

{{fileButton1.parsedValue[0] }}
This returns the parsed data fromt the CSV

The problem is that on the 'Accrued' field will show when typing in the value information. All other data items are not connecting to the table1 data.

1 Like

hey @eric_Moore and welcome to the forums!

what is the hover-over tooltip in the code editor for the squiggly yellow underlines? i would presume i is not in scope?

you can use {{table1.currentSourceRow}} for whatever row the user has clicked, if that helps. otherwise, if you want to do all rows in the table, I'd recommend a "Run JS Code" query.

if you want to export the table as the user sees it (with filtering, sorted-by, or hidden source data columns), there is table1.getDisplayedData(). otherwise, keep table1.data.

here's something that may help get you on the right track:

// skip hidden columns, and respect filtering/sorting
const tableData = await table1.getDisplayedData()
// const tableData = table1.data;  // or use the table's raw source data

// loop over rows, replacing "_" with " " in each header
return tableData.map(row =>
  Object.fromEntries(
    Object.keys(row).map(k => 
      [k.replaceAll("_", " "), row[k]])
  )
)

and then you can reference {{query2.data}} for your Firestore query. probably trigger Firestore as a Success handler for query2, and trigger query2 using some button.

1 Like

I'll echo @trz-justin-dev's welcome to the community, @eric_Moore! :wave:

Just to make sure I'm understanding your problem, your goal is to:

  1. Load a local .csv file using the "File Button" component.
  2. Populate a table with the parsed content of the loaded file.
    a. Possibly make edits to the table content.
  3. Upload one row of the table's content to Firestore

Is that correct? Can you clarify where in this process the problem is actually happening?

I think @trz-justin-dev has a valid point about i not being defined in the scope of your upload query, unless you have defined a global variable or triggered the query with additional context. The suggestion to use the table's selectedRow attribute or something similar is a good one!

I think we should be able to quickly help you out after gaining a little more clarity into the problem that you're experiencing. :+1:

1 Like