Question

Photo of Dennis Vasquez

0

How do I present the result count of a DataView in Lava?

Hi all!

New here, and to the platform :)

Hoping someone could help me with this...

I have various custom DataViews, and I simply want to grab the total record count it produces and present it on a page.

If you know SQL, it's basically similar to: SELECT COUNT(*) FROM SomeDataView.

I know the dataviews aren't stored in SQL Server (at least I don't think so?) - only their criteria.

So it's been difficult to even run a DataView outside the DataView area within Rock.

Any help would be appreciated!


  • Photo of Zack Dutra

    1

    Hey Dennis, this should work for you, but keep in mind you'd need to replace the data view Id and if you have a different entity than person, that would need to change as well. 


    
    {% assign dataViewId = 1 %}
    
    {% person dataview:'{{ dataViewId }}' count:'true' %}
        {{ count }}
    {% endperson %}
    
    
  • Photo of Dennis Vasquez

    0

    Oh wow! Thank you SOOO much, Zack!

    Where did you learn this?  I've looked through some of the resources here, but couldn't really find how to do this exactly (with explanation).

  • Photo of Sam DeSocio

    0

    Dennis welcome. If youre not in the chat community Id suggest you jump over there. 

    Zack gave you an entity command, which can be read about here:

    https://community.rockrms.com/lava/commands/entity-commands

  • Photo of Dennis Vasquez

    0

    Hey Sam, thanks!

    Thanks... I've been looking over classes and the books found here - very helpful. But, sometimes it's hard to find what I need - even with search. (It's going to take me a while to read and watch all the material)

    For example, I've tried looking for a way to list out all the Entities (in tag form). I could find versions of them in the database - so I imagine if it  has a space in it, it's just the same full name and remove the spaces?

    Ex: When using the dropdown box, I see "Content Channel Item", and looking at the link you gave me I saw this:

    {%contentchannelitem %}
    {% endcontentchannelitem %}

    Is it OK to assume if I just take out the spaces for any Entity I find, and make it all lower case, the Entity tags should work?

  • Photo of Sam DeSocio

    0

    Lava can feel pretty different, but it just takes some time. You'll get there. There is a great Lava class that Spark puts on. 

    Also Ive have really good luck with LLMs (I dropped all the manuals into a project and it was very helpful )
    You can also use ask chip. 
  • Photo of Dennis Vasquez

    0

    Gotta love LLMs. I'd use RAG locally - but my PC is not LLM good. So Claude it is!


    Thanks again!