Is it possible to download the entire field list for a table?

  • 0
  • 1
  • Question
  • Updated 12 months ago
  • Answered
Photo of Robert

Robert

  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,224 Points 20k badge 2x thumb
(1) Go to the field page for the table - the URL has this format:


h t t p s ://<subdomain>.quickbase.com/db/<table dbid>?a=listfields

(2) Then press F12 to expose the developer tools for your browser

(3) In the console tab paste one of these two scripts


_.pluck(gTableInfo[gReqDBID].finfo, "name").join(",")

_.pluck(gTableInfo[gReqDBID].finfo, "name").join("\n")

(4) Copy out your list of field names

(5) Celebrate your newfound joy of using JavaScript
Photo of Kimberly Kallo

Kimberly Kallo

  • 82 Points 75 badge 2x thumb
sweet!!  great tip!
Photo of Robert

Robert

  • 0 Points
I got to step 3 but nothing happened.  Do you have a little bit more explanation of the Step 3 naming process or is it exactly as you posted?
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,224 Points 20k badge 2x thumb
See Screenshot attached.
Photo of Caroline Phillips

Caroline Phillips

  • 60 Points
Hey this worked pretty slick!  Now if I am greedy and also want to include Field ID with the Field Label list, how do I add that piece?  I've tried to edit the code to add Field ID and FID like this, but this is not pulling any more than the record name.   _.pluck(gTableInfo[gReqDBID].finfo, "name", "fid").join("\n")
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,224 Points 20k badge 2x thumb
Here is the code to log the fid and field name to the console as a table display and as CSV:

console.table(_.map(gTableInfo[gReqDBID].finfo, (field, fid) => { return [fid, field.name]; })); console.log(_.reduce(gTableInfo[gReqDBID].finfo, (memo, field, fid) => { return memo + `${fid},${field.name}\n`; }, "" ));



Notes: 

(1) This code uses widely supported ES6 features:
  • backticks for string interpolation
  • fat arrow functions (ie =>)
I will increasingly use more ES6 features in my answers and demos and drop using jQuery. Ask if you need more information to make sense of the code.

(2) underscorejs is used to map gTableInfo[gReqDBID].finfo into an array of arrays in the first instance and to reduce gTableInfo[gReqDBID].finfo to a CSV string in the second.