Tell us what you are trying to do?
Present a view that shows the result of a calculation of multiple repeating group fields. these are date/time fields.
the calculation would take the 'in' and 'out' date/time for each of the records in the repeating group, and calculate the number of hours difference between the in and out. and finally, to sum all of those results for a grand total.
part 2: would it be possible to filter and/or sort based on that grand total?
I don't need detail - I just need to know if this is possible using toolset/toolset shortcode (and not straight up coding external to toolset) in order to accept or decline a job.
thank you!
Is there any documentation that you are following?
Is there a similar example that we can see?
What is the link to your site? hasn't been developed yet.
Hello,
There isn't such kind of built-in features within Toolset plugins, Toolset Blocks/Views plugin does not calculate the data, so you will need to create your own custom shortcodes to calculate the results.
yes, I understand there are no built in functions, but can we say there is nothing blocking me from making this happen by using shortcode? are there limitations on the datetime field, for example - anything that just isn't possible when it comes to calculations for data presented in a view, or for being able to filter on those calculations? thank you!
Toolset custom date field stores value in timestamp format:
hidden link
You can use date field values to calculate what you want.
Toolset repeatable field groups(RFG) are based on one-to-many relationship, each item of RFG is also a custom post(post type slug is your RFG slug), you can use relationship API function toolset_get_related_posts() to get items of repeatable field group, see our document:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
thank you Luo, and can you also confirm there's no reason why I wouldn't be able to use that calculated field result in a filter? ie, filter for everything where the fields total x amount. and also to be able to sort based on the calculated field result. thank you!
Toolset Blocks/Views plugins are using WordPress built-in class WP_Query to query WordPress posts, there isn't such kind of feature to filter/order the results by calculated field result, see WP document:
https://developer.wordpress.org/reference/classes/wp_query/