search cancel

format_toInt does not work

book

Article ID: 243533

calendar_today

Updated On:

Products

CA Workload Automation DE

Issue/Introduction

When using format_toInt as below :

var RET_CODE=WOB._cmpc

RET_CODE = format_toInt(RET_CODE) + 1

setVar('JOB1_RET_CODE',RET_CODE)

RET_CODE =0 + 1

setVar('JOB0_RET_CODE',RET_CODE)

we do not get the expected value.

 

Environment

Release : 12.3

Component : Workload Automation DE 

Resolution

 The following documentation confirms that the format_toInt function returns a "string" :

https://techdocs.broadcom.com/us/en/ca-enterprise-software/intelligent-automation/ca-workload-automation-de/12-3/scheduling/using-javascript/built-in-functions/integer-javascript-function.html

Integer Javascript Function

Specifies the value to convert into an integer format string.

In fact it is a bit confusing as it says "format_toInt" but giving a "string".

 

The recommended solution is to use the parseInt() function. Example :

c=parseInt("1888")

d=parseInt("1888")

e=c+d

The parseInt() function will allow to addition the values.