Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

array_agg postgresql in AC

szymons55769873
Level 2
Level 2

Hello

Is it possible to group (concat) certain string values in one column by common value in other column in AC Classic? I've tried with Group By but it's for numerical aggregates and there's a function in postgresql which does that (array_agg) and wondering if it's possible somehow to emulate it with activities? (Having in mind that with SQL Activity it's not possible to make outbound transition with select results)

Eg.

City             |  Country

------------------------------

Madrid          Spain

Barcelona     Spain

Paris               France

Nice               France

Output would be:

Madrid, Barcelona     Spain

Paris, Nice                  France

Kind regards

1 Accepted Solution
wodnicki
Correct answer by
Community Advisor
Community Advisor

Hi,

You can probably do this with queryDef, defining the groupBy independently of the <select/> and enabling unknown sql functions/adding array_agg function. If not it's just a couple lines extra to spool the results into a map then update the temp schema with '{' + map[k].join(',') + '}'.

Thanks,

-Jon

View solution in original post

1 Reply
wodnicki
Correct answer by
Community Advisor
Community Advisor

Hi,

You can probably do this with queryDef, defining the groupBy independently of the <select/> and enabling unknown sql functions/adding array_agg function. If not it's just a couple lines extra to spool the results into a map then update the temp schema with '{' + map[k].join(',') + '}'.

Thanks,

-Jon

View solution in original post