• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Submission total

Submission total 9 years 2 months ago #34222

Hi

I'm looking for a way to calculate total in a directory

Eg : we are collecting registration for a dinner, each submission requires a field with the number of participants


In the directory I'd like to have the total of reservations

How to do that?
The administrator has disabled public write access.

Submission total 9 years 2 months ago #34242

  • adrianp
  • adrianp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 631
  • Thank you received: 146
Hello,

You can try using a similar as the following script (added while editing your form directory > PHP Scripts > Scripts called on listing layout):
$db = JFactory::getDBO();
$db->setQuery("SELECT SUM(`FieldValue`) FROM #__rsform_submission_values WHERE `FieldName`='my-field-name' AND `FormId`='81'");
$directoryLayout .= 'Total: '.$db->loadResult();

You'll have to replace:

1. my-field-name, with the exact field name (case sensitive) you would like to sum up the total.

2. From `FormId`='81', the number, with your form ID (found via backend > Components > RSForm!Pro > Manage Forms > here, notice last column "Form ID" from the table listing).

PS: The query result is added at the end of the $directoryLayout variable (this holds your submission listing layout), which will show the amount after your directory table.
This is not official customer support. To receive your support, submit a support ticket here.
The administrator has disabled public write access.

Submission total 9 years 2 months ago #34248

Thanks a lot! It did it !
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!