Here's the code I have in a view to calculate a total...
[frm-stats id=531 type=total 419="[419]" decimal=2 dec_point="." thousands_sep=","]
the 419 field is a "Group Name" field and the groups that have an ampersand in the name are not calculating. For example "FAITH FREE & LUTHERAN"
I've tried the sanitize-url(https://formidableforms.com/knowledgebase/advanced/#kb-sanitize-url) on the 419 field but that broke all the calculations.
Also replaced "[419]" with "FAITH FREE & LUTHERAN" and that works I get a total but the total is only for that specific group. I need this to be dynamic.
It appears that when the view is created it converts the ampersand to something else or removes it so it doesn't match anymore and the frm-stats filters out everything, returning no total. How can I get the "[419]" to return the correct value?
I've also contacted support. They have identified this as a bug, but they suggested asking the community for any help on this.
Any help would be much appreciated.
If you post simply [419] in a view, does it return back exactly that (FAITH FREE & LUTHERAN)?
yes
Maybe for now try 419_contains=[419]? If that doesn’t work, best wait out the big fix.
Thanks for the idea, unfortunately I tried that and it didn't work. I was wondering if there was maybe a hook (https://formidableforms.com/knowledgebase-category/display-data-hooks/) that could help, but there are so many I'm not sure where to begin.
Hello, How did you manage to fix that? Or you were'nt able to?
@Bobby Clapp , Do you know if there is going to be any updates to get this fixed? My client is using a pro version on a production environment and facing issues due to miscalculations on field values with '&'
Any help would be appreciated.
Someone needs to bug it with the official Formidable support team.
I got a response from the support team. They provided a hook...
Our lead developer shared a hook that can be used to fix this issue. (please add the code below to your site). This snippet you can change the where value used for a stat shortcode. The shortcode value gets encoded so & is really & so it fails the check. This snippet changes all of those & back to & for the query:
add_filter(
'frm_stats_where',
function( $where ) {
$where['where_val'] = str_replace( '&', '&', $where['where_val'] );
return $where;
}
);
You can put the code in the WPCode plugin, your own plugin, or your theme's functions.php file. I recommend you put it in the WPCode plugin, which has some nice features and will allow you to retain the functionality even if you change themes.
https://wordpress.org/plugins/insert-headers-and-footers/
You can read about this in our documentation here:
https://formidableforms.com/knowledgebase/formidable-hooks/#kb-where-to-put-the-code
Please login or Register to submit your answer