Store string field data in table and perform calculations

shane_davis
Tera Expert

I am using a data lookup with the 3 fields below on my Change Task table. My goal is that to make calculations on each Change Task's score for the task's assigned to user.   Each user's score for each task needs to be stored in a table and be reportable.   I also need to change the field color for the assigned to field on the Change Request table based on what their current score is.    

The part I really need help on is taking the score from each Change Task and permanently storing it in a table to where I can make calculations off that data.


Failure type - choice such as Unauthorized

Failure cause - choice such as Planning

Failure score - string value which would populate to 10 based on two cause and type choices above.


Any help is appreciated!!

10 REPLIES 10

Anurag Tripathi
Mega Patron
Mega Patron

Hi Shane,



You are having problem to calculate failure score on change task or rolling it up on change request.


As per my understanding you have these 3 fields on change task


Failure type


Failure cause


Failure score


based on the first 2 the third will be calculated .


Now the scores from all the change tasks gets rolled up on change request.



Can you tell me if i am getting you right, if yes then which step are you stuck


-Anurag

Anurag,



        Yes, I have these 3 fields on the change task and based on the first 2 the third will be calculated.


  • Failure type
  • Failure cause
  • Failure score


My issue is that I don't know how to make calculations on an assigned to's scores.   For example, if I am the assigned to and I've completed 10 Change tasks in the last 90 days.   I need a way to calculate my score for the last 90 days.


Hi Shane,



For the change tasks what you can do is.


Create 2 client scripts, onchange (1 for failure type and 1 for failure cause)


on both, read the value of both the fields using g_form.getValue('failure type') and g_form.getValue('failure cause')


now do your calculaton and save the result on score field using g_form.getValue('failure score')



Now create a new BR on the change task table


after


insert/update


condition: current.failure_score.changes()


script.



//glide to the parent or use getRefRecord and sabe the score to the change_request



i still don't get what you mean by calculate my score for the last 90 days . i can suggest you the calculation but where and how are you seeing/visualizing it?


-Anurag

Anurag,



        My field choices for Type and Cause already calculate my Score per the screenshot below.  
screenshot.PNG



Every time I complete a change request, the failure score needs added to a new field which I don't have created, but would probably be Total score.   This new field would likely be on the Change Request table.   I would need this total score to start from 0 every 90 days.



Sorry if I am not explaining this right.   I hope this helps.