Calculation Problem

christianw19891

09-12-2015

The problem I am having remains in the "Days Remaining" column. If you are allowed 10 days in Block 1 and your "Block Start date" is "Dec 8, 2015" and your "Block/Eval End Date" is "Dec 9th, 2015" and you have "1" "CCTLR Ext. Day(s)".... the "Days Remaining" column should read "7" instead of "2" because the individual has used Dec 8 and Dec 9th and was allotted "1" extension day...It should read "8" instead of "7" if the 1 extension day wasn’t granted.  I hope this makes sense.  I have attached a screenshot of the scenario I setup as well as the coding that I currently have for the field "days remaining" 

Form.PNG

Coding.PNG

Accepted Solutions (0)

Answers (7)

Answers (7)

Magus069

MVP

14-12-2015

Sorry, my mistake... here is what I meant

Something like this can do the job

Basically, without this code, if you enter 1 it will show 100% in a decimal field with % display pattern

with the code above, if you enter 1, it will show 1%

christianw19891

11-12-2015

Thank you so much! I got it to work! As far as the percentage goes, I didn't quite understand what you were saying.  you said "and when you enter the field" twice which is where I am having troubles understanding. 

Magus069

MVP

11-12-2015

The only way I can think of to have a result of 7 in this case would be the following equations :

So the FormCalc equation would look something like this :

I hope this will help!

christianw19891

11-12-2015

Thank you for your quick replies.  Here is the equation I came up with:  Days Remaining=Days Allowed + (Block Start Date - Block End Date - 1) + CCTLR Ext. Days + Stop Days

Note: in this case, CCTLR Ext Days and Stop Days are going to be fields "NumericField35" and "NumericField47" respectively.

Thank you.

Magus069

MVP

11-12-2015

Hi again,

Can you explain the equation of how you are suppose to get those values?

Because obviously, your equation is not good, but I don't understand how you can get these values with the values you provided...

About the % field, when you enter a value in a field with % display pattern, you should be aware that any value entered in that field is multiplied by 100 to show the %

So how you can do this is, when you enter the field you divide the value entered by 100, and when you enter the field you multiply the value by 100 to always show the % wanted

christianw19891

10-12-2015

I am very sorry... you are correct! The "Day(s) Remaining" field should read 7 instead of "11" because "dec 8" and "dec 9" are considered to be used days and the "CCTLR Ext Days" gives the individual an additional day which, in turn, adds to the "days remaining" field. Now, if the field "CCTLR Ext. Day(s)" was valued at "0", then the "Day(s) Remaining" field should calculate to be "8" instead of "10" because the two fields you were referring to "NumericField35" and "NumericField47" added to the "Day(s) Remaining" total value rather than take away. document 1.JPG

document 2.JPG

on an unrelated topic.  Could you also help me code the "test results" field which I have as a NumericField in the document to read as a percentage when the end user inputs 100 so it can read "100%" when they click out of the field.  I appreciate your help.

Magus069

MVP

10-12-2015

Hi there,

there are some missing information in your description... what are the fields NumericField35 and NumericField47?

So if I understand well your line where you give the value to your field, would be interpreted like the following :

Unfortunately I could help you try to fix it, but I don't understand exactly what you are trying to do...

You are saying Day(s) remaining should read 7 instead of 2, but the value in your image is 11...

If you could explain in more details what you are trying to do would help me lead you the right way