I am using api v2 for gravityforms to submit to a form from a telegram bot.

This form have some calculation fields(value is calculated based on other fields).

I need to get the values of the calculated fields and show them to the bots user before actually submitting the form.

When there is only one calculation field, I can handle it, I get the form, and extract the formula from the field and parse it and get the value.

```
public function calculateFieldValue(&$form, $fields, $fieldId) {
$formula = $fields[$fieldId]['calculationFormula'];
preg_match_all('/\{[^\}]*\}/', $formula, $output_array);
foreach ($output_array[0] as $row) {
preg_match('/[0-9]+/', $row, $id);
$id = $id[0];
$fieldValue = $form['input_' . $id];
$formula = str_replace($row, $fieldValue, $formula);
}
return $form['input_' . $fieldId] = eval('return ' . $formula . ';');
}
```

But some of the fields are using conditional logic to have different formulas based on the input …

So is there any api or hack to tell gravity form to calculate the fields values before submitting it? or do I have to recreate the entire conditional logic of the gravityform and extract the correct field from the list?

would it be possible to do this with a plugin?

also posted here https://stackoverflow.com/questions/56215217/how-to-wordpress-gravityforms-calculated-field-value-with-api