cancel
Showing results for 
Search instead for 
Did you mean: 

Counting Arrays and sending data separated by semi-colons

aditya_gupta41
Contributor

Hello Experts,

I have an implementation where I have 2 set of data shown below:

Output1:
single_ss

Output2
multiple_ss

Here, Output1 comes with ‘single entry’ of Z1WSCOPE in an object. And Output2 comes with ‘multiple entries’ in an array.

What I am trying to achieve is:

  1. If the input is with single entry, then the output should be MNGRP | MNCOD | LTXA1
  2. If the input is with multiple entries, then the output should be MNGRP | MNCOD | LTXA1;MNGRP | MNCOD | LTXA1 (separated by ‘;’)

Thanks in Advance

1 REPLY 1

Abhishek_Soni37
Contributor

Hi @aditya.gupta41 ,

Try this expression:

$Doc.length == 1 ? $Doc[0].keys().join(“|”) : $Doc.map(x => x.keys().join(“|”)).join(“;”)

O/p window:
image

Sample pipeline:
Test_Expression_2023_06_26.slp (3.6 KB)

Let us know if it works 🙂