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
Problem with SUBSTRING in proces
Problem with SUBSTRING in proces
Using 8.7 Professional 3025 on MySQL/Windows
-
- Posts: 197
- Joined: Fri Jun 17, 2016 7:10 am
- Location: Brisbane Australia
- Contact:
Re: Problem with SUBSTRING in proces
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
Re: Problem with SUBSTRING in proces
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
Jaymer
Aware Programming & Consulting - Tampa FL
Re: Problem with SUBSTRING in proces
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?
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