Loop pipe response in javascript

Hey TB’s

I am looking for looping pipe response in Javascript. The response of pipe is array of objects I need to use the response object’s data for further processing.

Case :

Result is from users table. I have connection with ABC table.

1

I want to show users who are not present in ABC table for particular date(daily activity).

I too am looking for a solution to loop through an array without having to use Integromat/Make. I want to keep things within Tadabase.

Does anyone have any method using Javascript or other means to loop through an array? If anyone could share that solution, that would be great!

Hey @ashnil, @centellix, and the Tadabase community! :wave:

Here’s how you can do this: Loom | Free Screen & Video Recording Software | Loom

Click here to view the code used in the video
function getAllConnectedRecordsAndUpdateTheEmptyRecords(){
    // First, we run the Filter by a Single Field pipe
    TB.triggerPipe('eyJpdiI6IjNEY...', {
            tableId: 'lGArg7rmR6',
            fieldId: 'field_33',
            operator: 'is',
            value: '{pageField.Record ID}'
        },
        function (type, response, xhrRespone) {
            console.log('pipe response', type, response, xhrRespone);
            // Now that we got all connected records, we'll loop through each one and call the Update Existing Record pipe
            response.items.forEach(item => {
                if (item.field_32 === "") { // IF field_32 is blank
                    // Trigger the Update Existing Record pipe
                    TB.triggerPipe('eyJpd...', {
                            tableId: 'lGArg7rmR6',
                            field_id: 'field_32',
                            field_val: 'This record was empty',
                            recordId: item.id
                        },
                        function (type, response, xhrRespone) {
                            console.log('pipe response', type, response, xhrRespone);
                            $('#x_element_page_8_4 > div.table-responsive.table-outer-wrapper > div.table-actions.no-print > div.pull-left.form-inline > button').click();
                        }
                    );
                }
            });
        }
    );
}
TB.render('component_5', function(data) {
    $('#update-connected-blank-records').click(function(){
        getAllConnectedRecordsAndUpdateTheEmptyRecords();
    });
});
1 Like

@Chem hi, very interesting, another way to load JS and pipes. However I checked my pipes in some of my builders, and I don’t have the option to “copy” the pipe code to insert in the JS window page. Maybe is there something missing?

Hey @Aprada, I’ve enabled Pipe JS for your account. If anyone else wants this feature enabled for their account, don’t hesitate to get in touch with support.

1 Like