Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Lobo77
Contributor III
Contributor III

Concat distinct only

Hi all.

 

 

I am looking to concat the Status of distinct orders for a customer. Looking to do this front end , not script.

Data has a 'customer' level  – that can have multiple 'Orders' – and the Order can have  multiple 'Order Actions'.  However , each order action will have the same status.

Currently what I have is concating the statuses for the order actions  , when using aggr(concat(Status],'; ' ),[Customer]) . I know I am missing something very simple , and have tried many iterations   but have not been successful.

How would I do this for distinct order only   at a  customer level  ?

See below for current and expected result for 3 customers.

Any suggestions greatly appreciated.

Thanks.

CustomerOrderOrder ActionSTATUSUsing Currently    aggr(concat(Status],'; ' ),[Customer])Expected
186641678876427887643AClosedClosed; Closed; Closed; ClosedClosed
186641678876427887644AClosedClosed; Closed; Closed; ClosedClosed
186641678876427887645AClosedClosed; Closed; Closed; ClosedClosed
186641678876427888403AClosedClosed; Closed; Closed; ClosedClosed
19808651891975189198ACancelledCancelled; Cancelled; ClosedCancelled; Cancelled; Closed
19808676612407661595BCancelledCancelled; Cancelled; ClosedCancelled; Cancelled; Closed
19808676674797668574AClosedCancelled; Cancelled; ClosedCancelled; Cancelled; Closed
34383786886696168866962ACancelledCancelled; Submitted; Submitted; Submitted; Submitted; Submitted; Submitted; SubmittedCancelled; Submitted
34383786886907468869075ASubmittedCancelled; Submitted; Submitted; Submitted; Submitted; Submitted; Submitted; SubmittedCancelled; Submitted
34383786886907468869080ASubmittedCancelled; Submitted; Submitted; Submitted; Submitted; Submitted; Submitted; SubmittedCancelled; Submitted
34383786886907468869081ASubmittedCancelled; Submitted; Submitted; Submitted; Submitted; Submitted; Submitted; SubmittedCancelled; Submitted
34383786886907468869082ASubmittedCancelled; Submitted; Submitted; Submitted; Submitted; Submitted; Submitted; SubmittedCancelled; Submitted
34383786886907468869925ASubmittedCancelled; Submitted; Submitted; Submitted; Submitted; Submitted; Submitted; SubmittedCancelled; Submitted
34383786886907468870589ASubmittedCancelled; Submitted; Submitted; Submitted; Submitted; Submitted; Submitted; SubmittedCancelled; Submitted
34383786886907468870597ASubmittedCancelled; Submitted; Submitted; Submitted; Submitted; Submitted; Submitted; SubmittedCancelled; Submitted
1 Solution

Accepted Solutions
Lobo77
Contributor III
Contributor III
Author

Hi @ArnadoSandoval  , what ended up working was the below. It is not pretty , but it gives the result required. Thanks again for the assistance.

keepchar(aggr(concat(distinct [Order]&[Status],'; ' ),[Customer]),'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz; ')

Edit - added ';' to keepchar

View solution in original post

12 Replies
MayilVahanan

Hi Lobo,

Try like below

aggr(concat(dISTINCT STATUS,'; ' ),[Customer])

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
ArnadoSandoval
Specialist II
Specialist II

Hi @Lobo77 

Have you try?

Concat(Distinct [Status], '; ')
Arnaldo Sandoval
A journey of a thousand miles begins with a single step.
Lobo77
Contributor III
Contributor III
Author

@MayilVahanan  thanks , have tried. It gives me the distinct status for a customer , but not distinct order statues for a customer.  See customer 19808 , it has 3 orders , 2 cancelled and one Closed.  Distinct only gives me Closed and cancelled. I need to see the status for each distinct order. Thanks

 

Lobo77
Contributor III
Contributor III
Author

@ArnadoSandoval , thanks. Same issue as above. This gives me the distinct statuses for a customer , but not the statuses for the distinct orders for the customer. Thanks for looking.

ArnadoSandoval
Specialist II
Specialist II

@Lobo77 

Is this what you are trying to achieve?

01.Concact-Distinct.png

Arnaldo Sandoval
A journey of a thousand miles begins with a single step.
ArnadoSandoval
Specialist II
Specialist II

@Lobo77 

Or this?

01.Concact-Distinct-02.png

Arnaldo Sandoval
A journey of a thousand miles begins with a single step.
Lobo77
Contributor III
Contributor III
Author

@ArnadoSandoval 

Thanks again for looking into this.
Need to show Orders status/s for distinct orders for customer , would look like below: Notice customer 19808 has 3 order , 2 cancelled , and 1 closed.

Customer    Expected
186641         Closed
19808           Cancelled; Cancelled; Closed
3438378      Cancelled; Submitted

ArnadoSandoval
Specialist II
Specialist II

Hi @Lobo77 

I am attaching my Test.QVF application; I am getting the same results, but Can you explain why 19808 shows Cancelled twice, while 3438378 shows Submitted only once instead of many times?

 

Arnaldo Sandoval
A journey of a thousand miles begins with a single step.
Lobo77
Contributor III
Contributor III
Author

Thanks. 

It's shows many times as an 'order' may have many oder actions. All 'order actions', will all have the same status.  So for each distinct order , I want to show the status. But this is showing for order actions.  Hope this makes sense. Sorry cannot check the .qvf as cannot upload server. You got the same result as above?