Tadabase API retrieving records removing "duplicates"

When using the Tadabase API to retrieve records, other than Filtering is there any parameter or method that can be passed that would only return unique rows? I’m using the Get Only Specific Fields option so I only grab the author name field.

For example, if I had a table of Book titles that were connected to a table of Authors I might have the following records connected…

The Famous Five - Enid Blyton
The Island of Adventure - Enid Blyton
Harry Potter and the Sorcerer’s Stone - J.K Rowling
Harry Potter and the Goblet of Fire - J.K Rowling
The Da Vinci Code - Dan Brown

What I want to retrieve is a list of connections from Authors back to the Books (the User has bought/read) but only the first occurance of each, so just 3 records in this example:

Enid Blyton
J.K Rowling
Dan Brown

I’m working on the basis I’ll need to create a two step process for this but wanted to check there isn’t an easy option or if anyone else had tacked this kind of issue.

Thanks for any feedback

I’m wondering if a workaround would be to create this short-list on a standard TB Page in a picklist or Table and then use the Pages API to access that?..

…Whilst I don’t believe Custom Components can be used with the Pages API I could potentially apply some Javascript to table Component that removes the duplicates…maybe something along these lines…?
remove duplicates forum discussion

TB Dev-heads out there does this make any sense :grinning: ??

I think :thinking: if I can grab the array in Javascript and run this snippet of code against it, it should return only the records I’m after …

…anyone know if it’s possible to do this and grab the array to pass through this function?

To summarise I’m trying to restrict the number of records returned in a Page, Table and remove any “duplicates” (they’re not really duplicates just records containing the same information).

So my Table of Books will just display the (connected) Authors name but I only want each Author listed once. Therefore I want my table with 5 records Enid Blyton,Enid Blyton,J.K Rowling,J.K Rowling,Dan Brown to be reduced to only contain 3, Enid Blyton, J.K Rowling & Dan Brown

What about retrieving records from the authors table, filtered to only show those with connected records?

Hi Marty,

Thanks for your input @Marty I appreciate it - actually that’s what I’m doing already so only the connected records are showing but all 5 records (in this example are “connected”), yet I only want to display the three different Authors, do you see what I mean?

I think it’s going to need some Javascript but I haven’t worked out if it’s even possible to get the data array from the component although I think it’s probably “do-able” :thinking:

I think your Authors table would only have a single record for each Author?
In any case, you can get the data from your component using Javascript.
Are you familiar with the TB.render function? The record data is available inside that function as data.records.

Good point about the Authors table but I wasn’t clear in that example, there will be other Authors in the Authors table but I’m trying to create a subset that only shows a list of authors connected to these (a user’s) Books.

With regards to TB.render function, that’s exactly what I’m thinking but I don’t know how to reference the entire array rather than the individual records… I need to reference the array and run this function (highlighted above) on it to reduce it down I believe…

(@Chem @moe couldn’t share any thoughts on this could you?)

data.records will be an array. You could pass this to your function from within the TB.render function.

TB.render('component_3', function(data) {

function myFunction(data) {
    for (const element of data) {
         // add unique elements to new array

Did you know you can now filter with connected records? Understanding you’re trying to display a list of Authors, where the logged in user is connected a list of books that are connected to the Authors I believe you can accomplish this with the table data source filters. Check out this post for details: Connected Value Filtering | Tadabase

You are well ahead of me, I know. So apologies if this is a dumb idea.
I know this requires the connections to point the right way, but can you not use a Rollup field in the users table, with a concatenate unique on the authors ?

@GREDDIE this is something that’s not directly possible with the API. However, with a simple proxy I’m sure we can come up with a solution.

I’ll update you again soon if the idea I have in mind proves to work.

Hi @moe sometimes it’s just that I need to know - whether I’m barking up the wrong tree or I’ve missed something. I’m now just working on creating an API call in MAKE that will take the long list and reduce it so I’ think now I’m on the right track … :wink: I’ll post my solution for completeness (if I get there !) Thanks !