Help

How to get return a single cell value

Topic Labels: Extensions
481 0
cancel
Showing results for 
Search instead for 
Did you mean: 
vkramer
4 - Data Explorer
4 - Data Explorer

So, I am not sure if this is the correct location. I am also VERY new to airtable. I have taught myself to code in other languages, but I am by no means proficient in javascript.

I am trying to build an extension that will do the following:

  • read the value of a single cell (one record) on one table
  • update the values of specific fields (all records) on another table

Right now, I am having profound trouble getting started in defining a variable with that cell's value. I have poured through the airtable help and cannot find instructions on how to go about creating this variable. Below is the code that I am starting with (and getting constant errors).

 

 

import {
    initializeBlock,
    useBase,
    useRecords,
} from '@airtable/blocks/ui';
import React from 'react';
function TodoExtension() {
    const base = useBase();
    const table = base.getTableByName('PropertyDetails');
    const records = useRecords(table);
    const tasks = records.map(record => {
        return <Task key={record.id} record={record} />;
    });
    return (
        <div>{tasks}</div>
    );
}
 function Task({record}) {
     return (
         <div>
             {record.name || 'Unnamed record'}, {record.getCellValue('TuneUpUniform')}
         </div>
     );
 }
initializeBlock(() => <TodoExtension />);

 

PropertyDetails is the table I want to pull from. It only has one record (by design). The record I need from that is the value from the TuneUpUniform column.

I ultimately want to create a variable called pduniform that equals that value.

Clearly I am missing something. Any help would be appreciated.

 

0 Replies 0