Compare Numbers in ISC Workflows

Hi,

I have an Identity attribute which is a string and a define variable which is also string, I need to do a numeric comparison between the two.

Is there a option to convert a string into Integer before comparision

Hi Chandra,
You can try this one,

{
   "name": "Test Compare",
   "type": "static",
   "attributes": {
   	"AGE": {
   		"type": "firstValid",
   		"attributes": {
   			"values": [{
   					"attributes": {
   						"attributeName": "AGE",
   						"sourceName": "HR_USERS"
   					},
   					"type": "accountAttribute"
   				},
   				{
   					"attributes": {
   						"value": 0
   					},
   					"type": "static"
   				}
   			]
   		}
   	},
	   "flag": {
		"type": "firstValid",
		"attributes": {
			"values": [{
					"attributes": {
						"attributeName": "customAttribute12",
						"sourceName": "HR_USERS"
					},
					"type": "accountAttribute"
				},
				{
					"attributes": {
						"value": 0
					},
					"type": "static"
				}
			]
		}
	},
   	"value": "#set($Integer = 0)#if($Integer.parseInt($AGE) > $Integer.parseInt($flag))True#{else}False#end"
   },
   "internal": false
}

You can try this one to compare two identity attributes.Hopefully this should work
Thanks!!

6 Likes

HI Chandra,
I believe you trying to do in workflows, I do not see any option to convert string to number. Also define variable can be applied only to string and date operators, its not allowed for numerical values as per documentation.

What are you trying to achieve? you have the numerical value in string format in both identity attribute and define variable?
Thanks

1 Like

@girishkms1

we have a numerical value in string format in both identity attribute and define variable.

As given in the above post, we are able achieve this through a transform [doing numerical operation] and storing a result in a identity attribute.

1 Like

Thanks for the information Chandra. Good to hear that it worked.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.