How do I create Calculative Fields?

Created by Mark Eves, Modified on Wed, 4 Jan, 2023 at 4:56 PM by Alfie Jennings

An important feature to eForm fields where the platform will automatically populate or calculate the expected values of an item based on a given formula. You can use this feature in different ways as below:



  • Using Dynamic Fields



  • Using Page Item reference



  • Using Custom PLSQL Formula



Calculative Field usage:



  • Determine value of an item based on input provided by user in previous fields



  • Calculate Payment Amount based on type of purchase



  • Automatically populate logged-in user’s details in eForm fields



  • Write any custom calculations on field items by referencing value of other items




IMPORTANT INFORMATION: Please note that calculative fields do not currently work on forms used on the mobile app.


Key Objectives:-


  1. Creating Dynamic Fields
  2. Page Item Reference
  3. Custom PLSQL statements


Pre-Requisites:-


  • Basics
  • Forms
  • PLSQL





1. Creating Dynamic Fields





We have set of pre-populated list of dynamic fields which can be used as part of Calculative fields.  Any calculated value will need to be entered into the 'Default value' field for the item.  The 'Calculation point' within the item is typically set to 'On load'.







 


2. Page Item Reference


You can use reference any existing page items within the same category as a reference to calculate field values. The referenced item can also be on a different page but it must be prior in sequence to where it has been referenced.

 





You can reference any page item using {[ITEM_CODE]} where [item_code] should be replaced with actual item code.



 




The following screen is using two-page item values  and concatenates using the pipe line “||” symbol.  


 

 





3. Custom PL/SQL Formula examples


 






Example 1. Reference to an item from the Form, if the item is a select list this will use the 'key' value.


={ITEM1}


 


Example 2. To write static text:-



='This is my static text'


 


Example 3. To concatenate static text with some item reference, use the pipe line “||” symbol:-


 


={P_TAX_CODE}||' is your council text number’ ='The amount to be paid is £'||NVL({P_AMOUNT},0)


 


Example 4. To print date/time/date-time:-



=TO_CHAR(SYSDATE,'DD-MON-YYYY') =TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS')


or


=TO_CHAR(SYSDATE,'HH24:MI')


 


Example 5. To use arithmetic options:-



='Your total amount is '||(NVL({P_NO_OF_BINS},0)*15)||' GBP' 


or
=CASE WHEN TO_DATE({P_DATE},'DD-MON-YYYY') > SYSDATE+3 THEN '30' ELSE '15' END



 







Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article