AnsweredAssumed Answered

Troubleshooting a Script

Question asked by clogan on Jul 12, 2016
Latest reply on Jul 12, 2016 by clogan

Hello,

So my boss asked me to troubleshoot an old script that was built many years ago by someone other than me. This script is to create a new Job Number for a new job in our job database. It is supposed to start at .100 at the beginning of every year, and then increase by .001 every new job that is created. The problem is, whenever it creates a number that is a multiple of 10 (.150, .370, .400, etc) it will drop the 0s at the end of the number, and show up in the database as (.15, .37, .4, etc) instead of the hundred value it's supposed to be. I've done a little troubleshooting and haven't found anything outside of the script language that could be a problem. All of the fields mentioned are text or number fields. Can anyone tell me why it is doing this, and help me to fix whatever is causing it? Please let me know! The script is as follows.

 

Go to Layout [ "Weekly Report" (Jobs Database) ]

Show All Records

Sort Records [ Restore ; No dialog ]

Go to Record/Request/Page [ Last ]

Set Variable [$Trans ; Value: Jobs Database: :Transition Number ]

Show Custom Dialog [ "In the next screen, enter Department" ]

Enter Find Mode [ Pause ]

Perform Find [ ]

Sort Records [ Restore ; No dialog ]

Go to Record/Request/Page [ Last ]

Duplicate Record/Request

If [$Trans < Year ( Jobs Database: :Creation Date ) ]

     Insert Calculated Result [Select ; Jobs Database: :Transition Number ; Year ( Jobs Database: :Creation Date ) & ".100" ]

Else If [$Trans >= Year ( Jobs Database: :Creation Date) ]

     Insert Calculated Result [Select ; Jobs Database: :Transition Number ; $Trans + .001 ]

End If

Go to Field [ Jobs Database: :Job Number ]

Insert Calculated Result [Select ; Jobs Database: :Transition Number & "." & Jobs Database: :Department Code ]

Clear [ Select ; Jobs Database: :Done ]

Go to Layout [ "Project Record" (Jobs Database) ]

Perform Script [ "Make Schedule" ]

Outcomes