Problem with SUBSTRING in proces

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
robleer
Posts: 285
Joined: Wed Jul 14, 2010 7:01 pm

Problem with SUBSTRING in proces

Post by robleer »

Hi,

I have a problem with SUBSTRING. I try to fill an attribute with a part of a string.

I added a rule like this (and call an UPDATE to run this rule on every object):

CustomFieldModel.Geboortedatum=CustomFieldModel.Value ////this works and returns a string of 15 characters which is to long

CustomFieldModel.Geboortedatum=SUBSTRING(CustomFieldModel.Value,0,4) ///this gives an error

I get:

java.lang.StringIndexOutOfBoundsException String index out of range: 4


When I Edit the biz object and just save it, the rule works fine. So it looks like SUBSTRING cannot run when called via an process???

Tia

Rob
Using 8.7 Professional 3025 on MySQL/Windows
UnionSystems
Posts: 197
Joined: Fri Jun 17, 2016 7:10 am
Location: Brisbane Australia
Contact:

Re: Problem with SUBSTRING in proces

Post by UnionSystems »

Perhaps the error occurs if the attribute is UNDEFINED? You could try changing to

Code: Select all

IF CustomFieldModel.Value IS DEFINED THEN CustomFieldModel.Geboortedatum=SUBSTRING(CustomFieldModel.Value,0,4)
AWS Linux, Windows Server, AIM 8.4 & 8.6
Jaymer
Posts: 2454
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Problem with SUBSTRING in proces

Post by Jaymer »

I’m pretty sure I’ve never used a 0 in substring. Thought it starts at position 1. But I’m lying in bed. I could be wrong.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
BobK
Posts: 545
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: Problem with SUBSTRING in proces

Post by BobK »

Rob,

SUBSTRING does work in a process,
and the index does start at 0 (sorry Jaymer).

You said that you are running your rule on every object, are you sure that Value is populated with 4 or more characters in every object? Have you tried what UnionSystems suggested?
Bob
Post Reply