Expand my Community achievements bar.

SOLVED

Limit rows in each group using Split

Avatar

Level 4

Hi,

I am trying to use split activity to limit each of the data group to 2 rows.

I am getting the following error

XTK-170036 Unable to parse expression ' AND [temp:extract-grp:@internalRank]<=2'.

XTK-170037 'AND' is a binary operator. At least one operand is missing.

Executing extraction 'Subset' (step 'Split')

I have three fields in my table - Delivery, URL, Counts

I would like to get the top 2 rows in the group of each Delivery, URL

For example:

Delivery     URL     count

D1          abc         5

D1          abc1       3

D1          ABC3     2

D2           pqr        7

D2          pqr1       6

D3          pqr2       5

Expected output:

Delivery     URL     count

D1               abc       5

D1               abc1     3

D2               pqr       7

D2               pqr1     6

I am using the following documentation to perform the limit.

https://docs.campaign.adobe.com/doc/AC/en/WKF_Targeting_activities_Split.html#Limiting_the_number_of...

Can you please suggest what could have caused this issue.

Thanks a lot

Naveen

1 Accepted Solution

Avatar

Correct answer by
Level 7

Thanks Naveen for sharing it.

I have tried the same approach and it worked for me. The only difference is ,I have selected : limitations by group value (2) .

-Anita

View solution in original post

9 Replies

Avatar

Level 7

Hi Naveen,

Can you please help with the condition you have used in the split activity.

Meanwhile, you can try below approach :

Limit the selected records -> Keep only the first records -> Sort on the basis of "count" column from your table -> limit by grouping -> use the columns to group from your table -> limitations by grouping value (Enter 2)

Please ensure to add the additional columns in your initial query activity which you will be using in the split for sorting or grouping.

Let me know if this helps.

Thanks ,
Anita

Avatar

Level 4

Hi Anita,

Thanks for the response.

I have followed your notes and getting the same error.

XTK-170036 Unable to parse expression ' AND [temp:extract-grp:@internalRank]<=2'.
XTK-170037 'AND' is a binary operator. At least one operand is missing.
Executing extraction 'Subset' (step 'Split')

My method is given below which is giving me the same error.

Limit the selected records -> Keep only the first records -> Sort on the basis of All three columns (Delivery, URL, Counts) -> limit by grouping -> use the columns to group from your table (Delivery, URL) -> limitations by grouping value (Enter 2)

Thanks a lot

Naveen

Avatar

Level 4

Hi Naveen,

You can do this in the first query block using window function.

You have to create an additional attribute as RowNum(PartitionBy(Delivery), OrderBy(Desc(count)))

Then you can create a filter in refine target as line Number <= 2

Thanks,

Saikat

Avatar

Level 7

Hi Naveen,

Thanks for checking.

But it would be great if you can share the screenshot of split activity as just the error text is not really helping to understand the issue.

Also, if you want the top 2 records , I believe sorting on just the counts can help you get the required output.

Thanks,
Anita

Avatar

Level 4

Hi Anita,

I am pasting the screenshots of split activity below.

1827748_pastedImage_1.png

Avatar

Level 4

Hi Saikat,

Thanks for the suggestion. It worked for me.

However, I still would love to know how to do it using split activity.

Cheers...

Naveen

Avatar

Correct answer by
Level 7

Thanks Naveen for sharing it.

I have tried the same approach and it worked for me. The only difference is ,I have selected : limitations by group value (2) .

-Anita

Avatar

Level 4

Hi Anita,

Can you please share a screenshot of the 'limitations by group value (2)' screen.

Cheers...

Naveen