Count column value totals. | Community
Skip to main content
New Participant
Dec 11, 2018 8:24 AM UTC
Solved

Count column value totals.

Hi everyone,

This is my first post, so be gentle!

I'm also new to campaign, so be even gentler!

I am looking to find the most efficient way of calculating column counts of values. The challenge is making is fairly fluid.

The schema that I have, has (as of today), 69 columns. But this can vary on week to week. I'm looking at getting the column count and then sending an alert to someone if the count is 0...this must also count NULL values.

For example -

NameAgeShoe Size
John
Lee45
Elvis21
Greg
James54
Steve27

So this would give me counts of Name - 6, Age - 4 and Shoe size =  0.

This would then Alert to a user saying shoe size is empty!

I don't need to store the counts anywhere permanently.

Thanks to all!

Lee

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Amit_Kumar
Amit_KumarAccepted solution
Level 10
Dec 11, 2018 1:13 PM UTC

Hi Lee,

You need to build a query and in additional data use something like below

count(Iif((@Name=''), NULL, @id))

count(Iif((@age=''), NULL, @id))

count(Iif((@shoeSize=''), NULL, @id))

This should give you the exact count.

Regards,

Amit

2 replies

Jonathon_wodnicki
New Participant
Jan 3, 2019 7:21 PM UTC

Hi,

This can be generalized by iterating over the schema's cols to build a query def (or raw sql), then similarly iterating over the cols in the result.

Thanks,

-Jon

Translate
Amit_Kumar
Amit_KumarAccepted solution
Level 10
Dec 11, 2018 1:13 PM UTC

Hi Lee,

You need to build a query and in additional data use something like below

count(Iif((@Name=''), NULL, @id))

count(Iif((@age=''), NULL, @id))

count(Iif((@shoeSize=''), NULL, @id))

This should give you the exact count.

Regards,

Amit

Translate