Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Displaying a Confiform field as currency with background "set expression" calculations

Looking to see if this is possible. I have a simple form with user input fields for currency amounts. For the sake of example let's say I have (field1 + field2) / 3 = field3 where fields 1 and 2 are user input and field3 is based on the set expression rule of field1 + field2. What I really want is for my front end user to see the fields they input populate as $123,456.78 not 123456.78. Additionally, my form has division based math behind some of the fields and I want to force the result to 2 decimal places. I know that if set as a currency field using masking formatting I can get to this as a confiform record, but really need to display this at face value in the form. I've had some marginal success using JS but this ultimately breaks any math driven fields. Is this possible? Thanks!

1 answer

1 accepted

Hi

Take a look at this screencast, it uses ConfiForms Field Definition Rules macro to calculate the expression online and sets it on a readonly field in a form...

http://recordit.co/ooIVxj0SoR 

The expression I have is 

field3=(CONCAT("$", FORMATNUMBER(([entry.field1] + [entry.field2])/3,"###,###.00")))

Hope this helps

Alex

This is great Alex!

I assume that I can adopt the same logic for fields 1 and 2 (ex: !field1[empty]) something like that? or will that cause problems if the user makes an edit to a preexisting value?

Not sure I understand your question... the rule I have only kicks in when both fields have values... see the condition I have for the rule in my screencast

Sorry Alex, I think I phrased that poorly. 

So how would I plug that logic into a simple user input field that is void of calculations? In my example of field1 + field2 = field3, let's say I wanted to "display" field1 and 2 as $123,456.78 while still being able to facilitate the calculation to field3?

After looking into it a bit, I don't think that setting a field to display as "currency" will work with back end calculations being set. 

That being said, I do have a follow up question as I'm beginning to plug in some logic to do mat operations on the backend. 

I'm attempting to use an IF statement to "set expression" for another field. 

 

Here's a couple of examples I've attempted. Also all fields are set to numeric and "var1" is the result of a "set expression" rule to calculate itself. 

So this works:

Field Name - newmtgflex,dischargeamt

Condition - !newmtgflex:[empty] AND !dischargeamt:[empty]

Values to set - var1=([entry.newmtgflex]/[entry.dischargeamt])

This doesn't work

Field Name - newmtgflex,dischargeamt,var1,penaltypaid

Condition - !newmtgflex:[empty] AND !dischargeamt:[empty] AND !var1:[empty] AND !penaltypaid:[empty]

Values to set - var2=IF([entry.var1]:<=1,([entry.newmtgflex]/[entry.dischargeamt])*[entry.penaltypaid],[entry.penaltypaid])

 

I'm probably missing something obvious, let me know if you can help me out, thanks!

Hi

I think you are missing the quotes to help ConfiForms to recognize the arguments

var2=IF("[entry.var1]<=1","([entry.newmtgflex]/[entry.dischargeamt])*[entry.penaltypaid]","[entry.penaltypaid]")

See Math operations in ConfiForms 

Alex

I had thought about this over the weekend and thought that it was something that I had missed with the quotes around the variables. Tested and works, thank you so much Alex. 

Upping the difficulty level, I imagine that a nested IF statement would follow the same logic? 

IF("[entry.var1]<=1",IF("(([entry.newmtgflex]/[entry.dischargeamt])*[entry.irdamt])<1000",
"([entry.newmtgflex]/[entry.dischargeamt])*[entry.irdamr]",1000),"[entry.irdamt]")

Yes, you can nest expressions... just be careful with parenthesis match. as it becomes very quickly very "dirty"

Hehe, yeah I'm realizing that quickly, again, Alex, thanks for putting me back on the right path. :)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

⚡️NEW Group for Confluence Cloud Admins

Calling all Confluence Cloud Admins!  We created a new Community Group to support your unique needs as Confluence admins. This is a group where you can ask questions, access resou...

173 views 2 11
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you