Comments (16)
+1 bump... @jasoncrawford is the expand parameter live?
from api-docs.
Thanks, good idea. What we've been thinking is that this would be included by default when you pull a single record, but not when you pull a list of records. Do you want full data for linked records when you pull a whole sheet? That would probably be done with a flag.
from api-docs.
Yeah it would be nice to just be able to get "everything" in one shot, certainly would need to be behind a flag.
from api-docs.
+1 for that
from api-docs.
Thanks guys. We are planning to add this via an expand
parameter.
from api-docs.
Not yet, sorry! Will let you know.
from api-docs.
To develop this idea a little further it would be great to have a checkbox field you could use to select certain records in the ‘parent’ sheet, then create a JSON string which has the selected records in the parent sheet and the linked records in the ‘child’ sheets.
This JSON string could then be copied into a different book but which has the same , configuration of sheets, fields, and formulas. In this way institutions such as banks could completely transfer such things as data in a mortgage to another bank which has purchased that mortgage.
I’ve started a little Fieldbook Codelet to get the ball rolling. It works with Fieldbooks example database ‘sales pipeline’ with the addition of an ‘include’ checkbox column. So far can pull in all meetings records for the selected companies and return as JSON string.
const _ = require("underscore");
exports.endpoint = function (request, response, done) {
return client.list('meetings' ).then(function (plans) {
return client.list('companies' ).then(function (dudes) {
var keepers = _.where(dudes, {include: true }) ;
_.each (keepers, function(element, index, list) {
var meetups = [];
_.each (element.meetings, function(meetID, indxx, meets){
meetups.push(plans[meetID.id -1]) ;
} )
element.meetings = meetups;
});
return( keepers);
})
});
}
// Example of strategy for extracting records from child sheet with indexes found in parent:
// var A = [1,2,45,56,8.9,34,664,342];
// var B = [2,3,5]
// var C= [];
// _.each(B, function (element, index, list) {
// C.push(A[B[index]]);
// });
// C;
from api-docs.
Does this work a single record yet?
from api-docs.
(edit: sorry I keep hitting the wrong key and double posting) cleaning up formatting of @robertcarp's post, this could be used in an a codelet I'm guessing
const _ = require("underscore");
exports.endpoint = function (request, response, done) {
return client.list('meetings' ).then(function (plans) {
return client.list('companies' ).then(function (dudes) {
var keepers = _.where(dudes, {include: true });
_.each (keepers, function(element, index, list) {
var meetups = [];
_.each (element.meetings, function(meetID, indxx, meets) {
meetups.push(plans[meetID.id -1]);
});
element.meetings = meetups;
});
return( keepers);
});
});
}
// Example of strategy for extracting records from child sheet with indexes found in parent:
// var A = [1,2,45,56,8.9,34,664,342];
// var B = [2,3,5]
// var C= [];
// _.each(B, function (element, index, list) {
// C.push(A[B[index]]);
// });
// C;
from api-docs.
I found that in the "link settings" of a link field, if you update it to include the fields you want:
The API seems to eager load the linked records:
{
"count": 716,
"offset": 5,
"items": [
{
"id": 6,
"type": "Retail",
"activating_tl": [
{
"id": 369,
"date": "5/1/2013",
"value": "false"
}
]
},
from api-docs.
Oh ok. So in that way you can get all the fields in first children records. What would be nice is if you could do that for the linked 'grandchildren' records as well because with Fieldbook you can set up a tree like data structure with branches going down as far as you like. What would be great is to have a way to create a JSON text file corresponding to selected records in the root sheet, all the records from any linked child sheets, those child sheets children's records, and so on.
from api-docs.
@robertcarp What happens when you set link options to include grandchildren?
from api-docs.
Well thats just it. I'm not sure you can do that yet. I think its something planned however.
from api-docs.
@allthesignals @robertcarp Thanks guys… this will work but it's not really recommended, since what you're doing there is changing the display name of a record.
Let me see if we can get an expand
parameter in the API for you soon.
from api-docs.
@jasoncrawford
Thanks Jason.
from api-docs.
The expand
parameter is now live! See updated docs and enjoy.
from api-docs.
Related Issues (14)
- Deleting an item HOT 8
- Feature Request: Query by saved views HOT 4
- Access last or first item, Pagination or Sheet info HOT 2
- Feature Request: Access to column names HOT 6
- afterChange fired multiple times HOT 2
- Metadata API: Access the sheet to which a field/column is linked HOT 1
- Fetching image field and uploading to cloudinary fails HOT 1
- Return All Books HOT 3
- Formula data in responses HOT 1
- Add new fields to a sheet
- Feature Request: updated_at field HOT 3
- Feature Request: filter/query by list of items HOT 1
- Feature request: change notification via webhook HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from api-docs.