Git Product home page Git Product logo

Comments (16)

nathanwaters avatar nathanwaters commented on September 24, 2024 1

+1 bump... @jasoncrawford is the expand parameter live?

from api-docs.

jasoncrawford avatar jasoncrawford commented on September 24, 2024

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.

DeanWard avatar DeanWard commented on September 24, 2024

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.

thiagoperes avatar thiagoperes commented on September 24, 2024

+1 for that

from api-docs.

jasoncrawford avatar jasoncrawford commented on September 24, 2024

Thanks guys. We are planning to add this via an expand parameter.

from api-docs.

jasoncrawford avatar jasoncrawford commented on September 24, 2024

Not yet, sorry! Will let you know.

from api-docs.

robertcarp avatar robertcarp commented on September 24, 2024

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.

allthesignals avatar allthesignals commented on September 24, 2024

Does this work a single record yet?

from api-docs.

allthesignals avatar allthesignals commented on September 24, 2024

(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.

allthesignals avatar allthesignals commented on September 24, 2024

I found that in the "link settings" of a link field, if you update it to include the fields you want:
image
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.

robertcarp avatar robertcarp commented on September 24, 2024

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.

allthesignals avatar allthesignals commented on September 24, 2024

@robertcarp What happens when you set link options to include grandchildren?

from api-docs.

robertcarp avatar robertcarp commented on September 24, 2024

Well thats just it. I'm not sure you can do that yet. I think its something planned however.

from api-docs.

jasoncrawford avatar jasoncrawford commented on September 24, 2024

@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.

robertcarp avatar robertcarp commented on September 24, 2024

@jasoncrawford
Thanks Jason.

from api-docs.

jasoncrawford avatar jasoncrawford commented on September 24, 2024

The expand parameter is now live! See updated docs and enjoy.

from api-docs.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.