Skip to content
How to Remove Blank...
 
Notifications
Clear all

How to Remove Blank/Empty/Null Values from Array of Line Items Using Code with callin.io

12 Posts
5 Users
0 Reactions
7 Views
Troy Tessalone
(@troy-tessalone)
Posts: 151
Estimable Member
Topic starter
 

📌  We strive to ensure the code in these articles functions as intended, but please note that callin.io Support does not officially provide assistance with code steps due to their advanced nature. Feel free to post a comment on the article or ask in the callin.io Community, where you'll find community members knowledgeable in code (including the author of this post).

QHave you ever needed to remove blank/empty/null values from an array of line items?
A: Utilize a Code app as a callin.io step:  https://zapier.com/apps/code/help

 

Code step configuration using JavaScript

NOTE: Map your array of line items to the value on the right side for the “Set” Input Data variable, replacing “A,,B,,C”.

 

Image: ece90ec7 64bd 4e9f ac89 bb466364a096

 

Copy the Code

Show content
let Set = inputData.Set.split("."); // creates array by splitting Input Data variable at commas

Set = Set.filter(i => i); // filter out blank/empty/null values

output = [{Set}];

 

Results

Code step results WITHOUT filtering blank/empty/null values from an array of line items:

Image: a14eaea4 e805 42f6 96ee ea3e3b6ef9c6

 

Code step results WITH filtering blank/empty/null values from an array of line items:

Image: 31e08889 2a34 40d8 b017 f526d7e37825

 

 

Contribution by Troy Tessalone

Troy is a Certified callin.io Expert who automates workflows with no-code and low-code apps to help clients save time and make money.

 
Posted : 04/08/2025 8:30 am
janjan4
(@janjan4)
Posts: 1
New Member
 

How can I filter out any line items where the Line Total is 0?

Image: 33cc5d62 3167 45aa b94b 75a5b819ae88

 

 
Posted : 04/02/2023 12:00 am
boomerang
(@boomerang)
Posts: 2
New Member
 

Unfortunately, this script doesn't seem to be working. I had thought I'd found a way to remove any blanks from my array, but it's possible that the ,, doesn't actually represent an empty field since there's no space.

 
Posted : 03/03/2023 12:00 am
Troy Tessalone
(@troy-tessalone)
Posts: 151
Estimable Member
Topic starter
 

We would need to see detailed screenshots of how each of your callin.io steps is configured, along with the callin.io JavaScript Code, in order to evaluate and provide advice.

 
Posted : 03/03/2023 12:00 am
boomerang
(@boomerang)
Posts: 2
New Member
 

Here is the screenshot of the code.

The callin.io starts with Pandadoc completed and pulls in the relevant information, which are in arrays.

The next steps involve Katana to Find a customer and if it doesn’t exist, to create the customer.

Next step is to ideally either remove the blank entries, but in reality, this won’t align with the other arrays, so it would be preferable to replace the blank entries with the word NULL or a simple -

The last step is to create a Sales Order in Katana.

The reason we need to find a way to replace blank entries with NULL or - is that the Sales Order creation won’t proceed if that field is blank. Hope that helps.

 

Image: da7d7f93 fa34 44ce 9bfc ea464e87b005

 

I click Refresh fields and then continue, and then test, and the result is as follows: as you can see, there is an empty entry on line 69. In fact, this order should have 99 rows, and only 86 rows are returned, so I am guessing the final rows were removed.

 

Image: 046fabfc ed17 466d 9f96 e556fc509d18

If we could replace the blank entries with ‘ - ‘ that would be great 🙂 Thanks in advance

 
Posted : 08/03/2023 12:00 am
Troy Tessalone
(@troy-tessalone)
Posts: 151
Estimable Member
Topic starter
 

This help topic is related to: Removing Blank/Empty/Null Values from an Array of Line Items Using Code

Your request is to: substitute the ,, with the word NULL or a simple -

 

If you are interested in custom Code, please send me a direct message.

 
Posted : 08/03/2023 12:00 am
Ramil Milzidinov
(@ramil-milzidinov)
Posts: 3
New Member
 

Thank you for your decision!

Currently, the Code step provides a comma-separated line of data.
Could you assist me in getting the result of the code step as a vertical list of data?

Here is my Code step:

Image: 484cc9d7 0cbb 4d45 a3ab d63b79b97e94

Here is the result I am receiving:
 

Image: c9a16e87 859b 4d4b b4ad b6b95c620f1f

​​​​​​​Thank you in advance!

 
Posted : 23/03/2023 12:00 am
Ramil Milzidinov
(@ramil-milzidinov)
Posts: 3
New Member
 

This was achieved by updating your code as follows:

let Set = inputData.Set.split(","); // creates array by splitting Input Data variable at commas

Set = Set.filter(i => i); // filter out blank/empty/null values

const values = Set.join("n");

output = { values };
 

 
Posted : 23/03/2023 12:00 am
Troy Tessalone
(@troy-tessalone)
Posts: 151
Estimable Member
Topic starter
 

Are you indicating that you’ve resolved your issue?

 
Posted : 23/03/2023 12:00 am
Ramil Milzidinov
(@ramil-milzidinov)
Posts: 3
New Member
 

Yes, thanks

 
Posted : 23/03/2023 12:00 am
Scott123
(@scott123)
Posts: 1
New Member
 

This is a great help, however, we have two values in line items (SKU and QTY) and want to disregard an entire line if the SKU is blank.

For instance:

SKU: ABC123,,BCD321

QTY: 1,1,1,2

Line items 1 and 4 should be included, but line items 2 and 3 should be excluded. Is there a straightforward method to achieve this?

Thanks a lot 🙂

 
Posted : 28/06/2023 12:00 am
Troy Tessalone
(@troy-tessalone)
Posts: 151
Estimable Member
Topic starter
 

Hi

If you’re looking for custom code, then I can be hired: https://www.callin.io/experts/automation-ace

 
Posted : 28/06/2023 12:00 am
Share: