Conversion of NULL value in an array

101 views
Skip to first unread message

Durairaj

unread,
Mar 13, 2012, 1:00:48 AM3/13/12
to jb...@googlegroups.com
Hi all,

I have an array with the combination of alphanumerical and NULL values.
My requirement is avoid the the NULL values in this array. I have tried with CONVERT function but it's not working.
Can anyone help me with this?

For example: 

ARRAY.TEST = 'FX1000':@FM:'NULL':@FM:'FX2000':@FM:'NULL':@FM:'FX3000'


Thanks & Regards,
Durairaj. N

Mark Hogden

unread,
Mar 13, 2012, 11:26:50 AM3/13/12
to jb...@googlegroups.com

NAMC = DCOUNT(ARRAY.TEST,@FM)

FOR N = NAMC TO 1 STEP -1

   IF ARRAY.TEST<N> = “” THEN DEL ARRAY.TEST<N>

NEXT N

 

Or

 

CHANGE @FM:@FM TO @FM IN ARRAY.TEST  and then check for first and last null values.

--
IMPORTANT: T24/Globus posts are no longer accepted on this forum.
 
To post, send email to jB...@googlegroups.com
To unsubscribe, send email to jBASE-un...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en

Daniel Klein

unread,
Mar 13, 2012, 5:37:41 PM3/13/12
to jb...@googlegroups.com
ARRAY.TEST = TRIM(ARRAY.TEST,@FM)

Dan

Kevin Powick

unread,
Mar 13, 2012, 9:23:14 PM3/13/12
to jb...@googlegroups.com


On Tuesday, 13 March 2012 17:37:41 UTC-4, comp.lang.smalltalk wrote:
ARRAY.TEST = TRIM(ARRAY.TEST,@FM)


I believe that will only remove the first occurrence of a single FM from the array.  Not what the OP wants at all. 

Considering that I suppose it's possible to have multiple back-to-back nulls in the array, the OP could opt for Mark Hogden's first, reverse loop solution, or save a few cycles and just process the array with the Nulls included, but checking for their existence along the  way.

MAXX = DCOUNT(TEST.ARRAY,@FM)
FOR NDX = 1 TO MAXX
   IF TEST.ARRAY<NDX> # "" THEN
      ...STATEMENTS
   END
NEXT NDX

--
Kevin Powick
--
Kevin Powick

Durairaj

unread,
Mar 14, 2012, 1:56:40 AM3/14/12
to jb...@googlegroups.com
Thanks to all. 

TRIM function is working fine.

FAISAL FAYYAZ

unread,
Mar 14, 2012, 3:37:07 AM3/14/12
to jb...@googlegroups.com
Hi,

Try this

ARRAY.TEST = TRIM(ARRAY.TEST,'','D')

Regards,

Faisal


--

Kevin Powick

unread,
Mar 14, 2012, 10:04:11 AM3/14/12
to jb...@googlegroups.com


On Wednesday, 14 March 2012 03:37:07 UTC-4, Muhammad Faisal wrote:
Hi,

Try this

ARRAY.TEST = TRIM(ARRAY.TEST,'','D')


Not only does that not remove null attribute values, it also has the, possibly undesirable,  side-effect of removing leading, trailing and redundant spaces from the entire array, including non-null attributes.

--
Kevin Powick 

Kevin Powick

unread,
Mar 14, 2012, 10:10:01 AM3/14/12
to jb...@googlegroups.com


On Tuesday, 13 March 2012 17:37:41 UTC-4, comp.lang.smalltalk wrote:
ARRAY.TEST = TRIM(ARRAY.TEST,@FM)

Dan


Dan,

Your answer is correct.  Sorry for stating otherwise.

I mistakenly though that for using TRIM to remove leading, trailing, and redundant characters other than spaces, one had to include the 'R' parameter.  TRIM(ARRAY,@FM,'R').  It yields the same result, and I guess is the default behaviour when 'R" is not included.

--
Kevin Powick 

zakihy...@gmail.com

unread,
Mar 14, 2012, 11:31:23 AM3/14/12
to jb...@googlegroups.com
Sent from my BlackBerry® smartphone from Uganda Telecom

From: Kevin Powick <kpo...@gmail.com>
Date: Wed, 14 Mar 2012 07:10:01 -0700 (PDT)
Subject: Re: Conversion of NULL value in an array
--
Reply all
Reply to author
Forward
0 new messages