Filter based on number of line items

Status
Not open for further replies.

GSG

Member
Hi

I am looking for a solution whereby I can 'filter' based on the number of items in line items array.

I would like the workflow only to continue if there is just the one line item.

Workflow so far is Woocommerce order > Pabbly Data Transformer, and before proceeding with further steps I would like to add the filter noted above.

Thanks for any suggestions or workarounds

Graham
 
P

Pabblymember11

Guest
I am looking for a solution whereby I can 'filter' based on the number of items in line items array.
You can use the Code by Pabbly action step to identify the number of line items and as a result, it will show the number of line items that you can use in the filter action step.

1688639148322.png


const lineItems = [1, 2, 3, 4, 5]; // Example array const numberOfItems = lineItems.length; console.log("Number of items:", numberOfItems);
 

GSG

Member
hey thanks for your help.

I don't get the same output info as you. Please see attached screenshot. It records output as logs. Am I missing something?
 

Attachments

  • Screenshot 2023-07-06 at 21.27.11.png
    Screenshot 2023-07-06 at 21.27.11.png
    347.8 KB · Views: 170
P

Pabblymember11

Guest
const lineItems = [1, 2, 3, 4, 5]; // Example array const numberOfItems = lineItems.length; [B]return[/B]("Number of items:", numberOfItems);

Kindly try passing the return in the last line.
 
Status
Not open for further replies.
Top