Is it possible to set function argument with variable ?
Asked by laurent:

I need two fields. One formula field to calculate a value and second field (rule or IFTTT) to run a function with the calculate value.

For example formula field result give me a number and I want use this number as argument in function trunk(var) or trim(var) or other function with argument.


Answers:
author: Katerina Kovriga {Stiltsoft}
body: Hi [@laurent](/t5/user/viewprofilepage/user-id/4155869) ,

I guess you use ConfiForms tables and want to perform calculations in such tables.

Maybe our app will come in handy for your case - [Table Filter and Charts for Confluence](https://marketplace.atlassian.com/apps/27447/table-filter-and-charts-for-confluence?hosting=cloud&tab=overview). The app works with the TableView macro perfectly well: you just [wrap your TableView macro in our macros](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+the+app+with+the+ConfiForms+app) and perform various calculations, filter data, create pivots and charts.

To calculate some values using custom formulas, you may try the Table Transformer macro. It has two default presets (to merge and lookup tables) and a custom preset where you can paste your own SQL query to perform calculations.

![Thu 1-1.png](https://community.atlassian.com/t5/image/serverpage/image-id/120612i00067C0CEEFE850F/image-size/large?v=v2&px=999 "Thu 1-1.png")

[Here](https://docs.stiltsoft.com/display/public/TFAC/Custom+Transformation+-+use+cases+with+advanced+SQL+queries) are the most common uses cases from our customers (using math formulas, comparing dates, calculating work periods, conditional formatting, etc.). Hope you'll find something that will help your case.

comments: author: laurent
body: Yes I use confiforms table but I think it's possible to calculation within confifiorms fields.

Otherwise I will test you suggestion.


author: Alex Medved _ConfiForms_
body: Hi

From ConfiForms version 2.16 you can have dynamically looked up parameters in trunc\*/trim\* set of functions (as always you reference field value via \[entry.field_name\] notation).

(also supported in ConfiForms cloud)

Alex

comments: author: laurent
body: Ok its a good news.

I must have pb with syntax :

entryId=\[entry.id\]\&TESTFIELD=\[entry.TEXTTOTRUNC.truncRight(\[entry.VALUEFIELD\])\]

I obtain RESULTFIELD="entry.TEXTTOTRUNC.truncRight(\[entry.VALUEFIELD\])"....


author: Alex Medved _ConfiForms_
body: Not sure I understand you comment

Here is my quick test with your expression: <http://recordit.co/K9pcI0dUdq>


author: laurent
body: Ok so this is possible. Now I think that my pb comme from VALUEFIELD. In my Form VALUEFIELD is the result of a calculate. I calculate length of the text entry in TEXTTOTRUNC field with function LEN(\[entry.TEXTOTRUNC\]) - 2 or 3 (for e.g.) so VALUEFIELD get value of Len function and I obtain the correct number to use in the IFTTT. I think that my pb is the result in VALUEFIELD is not consider as a real number value but perhaps as a text value or something like that.

I wil re-try this solution and perhaps calculating VALUEFIELD is not absolutely necessary in my application.....

TY very much for the time you paste to try help me

Wish you happy new year


Tags: confiforms