Dynamic Content Expression

166
5
Jump to solution
2 weeks ago
Highlighted
New Contributor III

Trying to have text that counts the number of records in a database in which a specific attribute is "Yes".

What formula do I need to enter into the Expression box, so that if 3 of the 5 records have "Yes" for a specific attribute, then the number displayed is "3"?

JasonCyphers_0-1605881731908.png

 

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
New Contributor III

Hi Jason,

You can create a View of your layer within Experience Builder and filter to only the ones that say Yes. So, in the expression box you insert Count() and select which view the data is coming from, if it's default or the data view you created:

Create the Data View here:

BrunoSousa1_0-1605883441412.png

 

Select the Data Views when you connect the widget to data

BrunoSousa1_1-1605883548075.png

Insert COUNT() and select whitch data view it's counting from:

BrunoSousa1_2-1605883634649.png

 

Let me know if this helps.

Best

View solution in original post

5 Replies
Highlighted
New Contributor III

Hi Jason,

You can create a View of your layer within Experience Builder and filter to only the ones that say Yes. So, in the expression box you insert Count() and select which view the data is coming from, if it's default or the data view you created:

Create the Data View here:

BrunoSousa1_0-1605883441412.png

 

Select the Data Views when you connect the widget to data

BrunoSousa1_1-1605883548075.png

Insert COUNT() and select whitch data view it's counting from:

BrunoSousa1_2-1605883634649.png

 

Let me know if this helps.

Best

View solution in original post

Highlighted
New Contributor III

Awesome, thanks!!

Is there, by chance, a way to perform a calculation to show the feature count, that has the attribute as "Yes", as a percentage of the total features in the database?  

JasonCyphers_1-1605886993751.png

 

 

Highlighted
New Contributor III

There is. You can add COUNT()/COUNT()*100, and select the data views for each COUNT(). However the result has lots of decimals and I don't know how to change that

Highlighted
New Contributor III

Thanks again!!

 

haha, yea, need to figure out a way to format the text to limit the decimal places!

Highlighted
New Contributor III

Is there a way to do any conditional formatting?  If the expression resulted in a value 50% or more, could you format the text to be bole red, otherwise it remains the default?

Reply
0 Kudos