Substring on a Substring Runtime Error

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Substring on a Substring Runtime Error

Post by jyoung »

I am getting an unhandled runtime error when I try to do a substring on a substring'ed string.

For example, this code triggers the error.

Code: Select all

evtroutine handling(#Button1.Click)

define_com class(#PRIM_ALPH) name(#stringToParse)
define_com class(#PRIM_ALPH) name(#attribute)
define_com class(#PRIM_ALPH) name(#attributeName)
define_com class(#PRIM_NMBR) name(#delimiterPosition)

#stringToParse := "username|attribute:value"

#attribute := #stringToParse.Substring( (#stringToParse.PositionOf( '|' ) + 1) )

#delimiterPosition := #attribute.PositionOf( ':' )

* error occurs here
#attributeName := #attribute.Substring( 0 #delimiterPosition )

endroutine
The delimiterPosition correctly comes out to 10 (which is less then the attribute length so it should not be a length issue). The PositionOf function here works, but in a ServerRoutine (where I initially experienced this) the error would happen on PositionOf.
Here in a Windows Form it happens on the Substring.
Here is the x_err.log

Code: Select all

Tue Jun 13 15:12:18 2017 
Release 14.1.0 Build 4138 Windows 10 Enterprise Edition (10.0.0.0 Build 10586)
---LANSA Installation/Upgrade 14.1.0 Build: 4138 (3/6/2017 8:45:11 AM)
---EPC141010 (Visual LANSA V14 SP1 VL Web)
---EPC141011 (Visual LANSA V14 SP1 Latest Fixes)
---EPC141017 (Visual LANSA Framework)
---EPC (06-03-2017 09:15:32)
---EPC (06-03-2017 09:19:00)
---EPC (14-03-2017 08:20:01)
---LANSA Installation/Upgrade 14.1.0 Build: 4138 (5/25/2017 12:15:57 PM)
Component : JRYFRM01
   Test Form 1
Statement : 30
Message : Unexpected or unhandled runtime error - Failure( *INVALID_VALUE ) ReportedBy( File:X_VarEvaluations Line:31978 )
Routine : X_VarEvaluations
Job Number: 001700 OS User : JRYoung
DBUT=MSSQLS FORM=JRYFRM01 PART=DEM LANG=ENG USER=DCXPGMLIB DBII=LANSA DBIT=MSSQLS GUSR=*NONE HLPC=461050 LOCK=YES TASK=TDEM0001 DEVE=Y DATF=MDY DRIV="C:\PROGRA~2\LANSA\X_WIN95" PRTR=LPT1 DBUG=N ITRO=N ITRM=20000 ITRL=4 ITRC=ALL ITHP=X DBCL=2 DBCF=CT_INTEGRATED_LOGON:Y RNDR=W RNDM=H
dannyoorburg
Posts: 177
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

Re: Substring on a Substring Runtime Error

Post by dannyoorburg »

Hi,

RDML, unlike most C based languages, starts counting at 1. It's the 0 for start position that is probably giving you INVALID VALUE.

Danny
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Substring on a Substring Runtime Error

Post by jyoung »

Ugh, good grief. I spent all day trying to figure out what as going on.

Thanks,
Joe
Post Reply