Full Dynamic Tables on CRMA - Part 1

Full Dynamic Tables on CRMA - Part 1

CRM Analytics is a superior visualization tool. You can achieve many things with it.

It has improved a whole lot in the last couple of years… but I remember the beginnings.

It was a bit clumsy and you needed to do almost everything through code.

That changed a lot. Now you can achieve so much just by using the UI.

One element that for some time I felt was left behind was the Table Widget. It took a while to improve but it looks so much better now. You can customize it pretty much however you want.

You can create advanced calculations using the included functions, add columns, filters and more. The challenge comes when you need to apply dynamic groupings or have advanced bindings in your code.

This will be a series of post where I will try to cover one simple use case and multiple advanced ones.

I am assuming you have at least the basic knowledge about Bindings, JSON and SAQL.

Simple Compare Table with Dynamic Groupings (Compact Mode + Bindings)

You can use any dataset that you have but I will use this one:

Here is the XMD to format the dataset when uploading the CSV:

Now I will create the following compare table and then clip it to a dashboard:

No alt text provided for this image

I named mine “compare_finance_table”.

Now create a static step with the following values:

No alt text provided for this image

Add a list widget to your dashboard, assign the static step and configure it to be Single Selection Required. You should have Solution Group as the default selection.

No alt text provided for this image

Now it’s time to play with the code.

We will need to replace the current grouping in the table with the values from the static step with the following binding:

{{cell(static_grouping_1.selection,0,'value').asString()}}        


No alt text provided for this image
Before


No alt text provided for this image
After

f you are following the exact same example you should see 4 “groups” sections that you need to modify.

After doing so, you should have your first dynamic table:


No alt text provided for this image
Default Selection: Solution Group


No alt text provided for this image
Business Unit


No alt text provided for this image
Master Client

Remember to save your work.

Now let’s go one step further… Do you remember we configured the static step to be Single Selection Required? What would happen if you change it to be Multiple Selection Required?

Try it… make multiple selections.

See?

Nothing changed. And the reason for that is because we used the “cell” function in the binding and it’s returning only the value in the position “0”.

What we are going to try is to allow the user to select multiple groupings in whatever order they want. To do so, we need to make a few changes.

First, we need to change how the static step is written. Go ahead and add the following values to the step:

No alt text provided for this image
This will allow us to pass the values as arrays not plain strings

Now we need to change the binding a bit. To allow it to handle multiple values at the same time we need to use the “column” function and the “asObject” serialization:

{{column(static_grouping_1.selection,['value2']).asObject()}}        

If you go ahead now and replace the binding and try to run the code… it will error out:

No alt text provided for this image

There is a reason for this error. There are too many square brackets around the “groups” section. You need to remove all of them. If you are following this example, you should have 2 levels of square brackets.

No alt text provided for this image
Before


No alt text provided for this image
After


When that’s done, your table should have superpowers!

Go ahead and try any combinations in the list selector (remember to configure it to be Multiple Selection Required):

No alt text provided for this image


No alt text provided for this image


You can start having fun.

I will add Date dimensions to it. Year and Month:

No alt text provided for this image


And if it wasn’t awesome enough… Try adding a chart widget to your dashboard and assign the table step to it…

Boom! Achievement Unlocked: Full Dynamic Charts!

No alt text provided for this image
Try making any selection… The chart should reflect the changes without problems.


These are the basic tools to create a lot of fun stuff.

This covers the first use case: Compact Mode Table + Bindings.

I have in mind a few more advanced use cases that will require only SAQL steps. No Compact Mode. Let’s see how many parts this series ends up having.

Summer 18' was used to write this article.

I hope you find this helpful.

Leave a comment if you have any questions or improvement ideas.

Thanks for reading!


Noah Gampe

Data Analyst

11 个月

Did this functionality get changed? I'm using Summer '24 and I can't get this to work. I can get it to work with single selections, but multiple selections breaks it.

回复

要查看或添加评论,请登录

Pedro Gagliardi的更多文章

社区洞察

其他会员也浏览了