In <wpv-loop> I am trying to do this query, " select sum (wpfc-conuts) GROUP BY (wpfc-comment-type) "
How creat shortcode for this function ?
I followed up this https://toolset.com/forums/topic/calculating-types-custom-fields-and-display-in-html-container/
It's work nice but I can not GROUP BY field 🙁
the result come like this :
---------------------------------
5 - Thanks
1 - Survey
1 - Help
1 - Help
1 - Compliment
2 - Comment
1 - Comment
1 - Comment
1 - Comment
1 - Comment
4 - Comment
Total = 19
---------------------------------
and I need result group by wpcf-comment-type like this:
--------------------------------
5 - Thanks
1 - MOPH Survey
2 - Help
1 - Compliment
10 - Comment
Total = 19
-------------------------------
Dear Ahmed,
I suggest you create the view filter by shortcode attribute, manually output the group result, for example:
Thanks: [wpv-view ... comment-type='Thanks']
MOPH Survey: [wpv-view ... comment-type='MOPH Survey']
...
See our document:
https://toolset.com/documentation/user-guides/passing-arguments-to-views/#controlling-the-filter-with-shortcode-attributes
Controlling the filter with shortcode attributes
Thank you for your reply, can you explanation how can use this:
-----------------------
Thanks: [wpv-view ... comment-type='Thanks']
MOPH Survey: [wpv-view ... comment-type='MOPH Survey']
----------------------
please give me step by step .
Thank you
You can edit your view, in section "Query filters", add a Custom field filter:
Select items with field:
comment-type is a string equal to VIEW_PARAM(commenttype)
Then use shortcode in content
-----------------------
Thanks: [wpv-view ... comment-type='Thanks']
MOPH Survey: [wpv-view ... comment-type='MOPH Survey']
----------------------
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/#2
Shortcode attribute
The value for the filter comes from an attribute in the View shortcode
You’ll be able to insert the same View in different places and control content filtering via the View Shortcode.
Thank you a lot 🙂 I have note:
commenttype='Thanks' <== like this its working fine
comment-type='Thanks' <== like this Not working
with ( - ) not working because its must same VIEW_PARAM(commenttype)