BAQ Calculated field for alternating colors in Dashboard

Hello all!
I am working on a dashboard with a BAQ returning a list of part numbers. I know that I can group the results in the grid by part number, but instead I want to color every other group of part numbers without using the grouping or group by. Since they are sorted by part number, the coloring can be just two colors. There can be one or more part numbers in the resulting list, and the color should alternate for every other unique part number.
Capture33
I believe I need to accomplish this with something like a running total, or sum over partition. Ideally, a calculated field that switches between 1 and 0 for every other part number would let me assign the alternating colors in the dashboard view rules. I just cant figure out how to generate that calculated field!

I think that this post hits on exactly what I need I just am having trouble with the syntax.

What do you think?
Thanks for your time!
Nate

One way to get a calculated field to use in your dashboard view rules could be to group up the parts in a subquery (same order as they will be displayed in dashboard), assign a row_index, do a modulo on the row indexes to turn it into 2 values (even/odd), then join these modulo’d row_indexes back with your non-grouped part list. Probably not the best explanation, and there may be an easier way, but this could work.

I messed around with this using the PartTran table. Here’s some pics.

Subquery’s calc fields:

Subquery Results:

image

Subquery Joined with original part list results:

image

2 Likes

Try this:

3 Likes

Thank you! Once I took my entire query and set it as a subquery I was able to generate the new row numbers and identify every other one. Perfect!

1 Like

I actually ended going back and using Dense_Rank instead. Thank you!

This is an awesome example of extreme geekiness overlapping with actually caring about the user’s experience to produce something so seamless, no one would know it was not actually part of the system. Good job, smart people. I’m bookmarking this one.

2 Likes

I just want to point out though. That if anyone re-orders the grid on another field, those fancy bars won’t help. So for a lot of places, it just isn’t worth it, but it obviously depends on the application.

1 Like