PxPlus User Forum

Twitter Twitter Twitter

Recent Posts

Pages: 1 [2] 3 4 ... 10
I've used both methods to load arrays. I noticed that Mike had used a dynamic array to do the loading in his example, but when I tried it, I only get 1 entry. Just looking for clarification.
Thanks for the ideas.
Wish List / Re: Sort Array
« Last post by James Zukowski on June 23, 2022, 09:28:20 AM »
One of the primary intents is to add entries to a list, sort the list, and then load that sorted list into a list_box. Whereas the SRT() function can be used on a string list, I believe having it available for arrays would enhance the functionality of the language.

I have yet to use associative arrays. I've found dynamic arrays to be extremely useful. I'm not sure how well they would work in the intended process.

That's a real slick method, and I'll probably take advantage of it. I just have to remember it.

Thanks, all!

(Still 'dreaming' of the SRT() extension...)
Wish List / Re: Short-hand syntax for anonymous arrays or objects initialization
« Last post by RobL on June 22, 2022, 08:55:28 PM »
Pardon me jumping in..

Try loading the dynamic array like this:
Code: [Select]
dim Fld$[*]
for element$ from Rec$
print sub(rec(cpl("iolist Fld${all}")),sep,",")

Hope this helps!


Rob Leighton
Wish List / Re: Sort Array
« Last post by Loren Doornek on June 22, 2022, 06:50:36 PM »
I've sorted string arrays using this logic.  The sort is all done in one line (line 40).  The rest of this is just setup for demo purposes.

Code: [Select]
0010 BEGIN
0020 LET data$="Red,Orange,Yellow,Green,Blue,Indigo,Violet,"
0030 DIM a$[1:POS(","=data$,1,0)]; READ DATA FROM data$,SEP="," TO a${ALL}
0040 READ DATA FROM SRT(REC(CPL("iolist a${all}"))) TO a${ALL}
0050 PRINT "Raw Data:    ",data$
0060 PRINT "Sorted Data: ",REC(CPL("iolist a${all}"),SEP=",")
It seems to work if you pre-dim the array size:

0100 DIM y$[15]
0200 READ DATA FROM "a,b,c",SEP="," TO y${ALL}
0300 PRINT y$[0],'LF',y$[1],'LF',y$[2]
Wish List / Re: Sort Array
« Last post by keith.mcbride on June 22, 2022, 05:51:23 PM »
You can use the associative arrays (hash arrays) that are available:

100 dim a
200 a["03"]=3
300 a["01"]=1
400 a["02"]=2
500 for i$ index a{all}
600 print a[i$]
700 next i$

running gives

I think of the hash arrays as just a simplified memory file. Although they are implemented differently than a memory file.
Wish List / Sort Array
« Last post by James Zukowski on June 22, 2022, 05:05:19 PM »
Would it be possible to extend the capabilities of the SRT() function to include (1-dim) arrays? This would be useful when using dynamic arrays instead of *memory* files. Example:

Code: [Select]
New${all}=srt(Old${all}) ! String
New{all}=srt(Old{all}) ! Numeric

Optional parameter: Case-insensitive (1/0)
Very optional parameter: Dimension# to sort on (1-3)
Very very optional parameter: Reverse sequence (1/0)

Sorting 'in place' would be supported, e.g.: A${all}=srt(A${all})

Thanks for considering!
I was reviewing things for another topic, and stumbled across this one, with this comment:

To quickly create and load an array try:

dim Y$[*]
read data from "Mike,Was,Here",sep="," to Y${ALL}

I've tried doing this type of thing, but it doesn't seem to work. More specifically:
-}read record (1,key=k$)Rec$
-}dim Fld$[*]
-}read data from Rec$,sep=sep to Fld${all}
-}?dim(read num(Fld$))

-}?dim(read num(Fld$))

Is there something I'm missing? I've been looking for something like this for a while.

Registration and Setup / Re: Linux Licensing
« Last post by michaelgreer on June 21, 2022, 06:51:15 PM »
Thank you.  I figured if Windows could do it so could linux but I didn't thing the -bkg did anything in linux.
Webster Plus / Re: Problem with filling grid
« Last post by Jelle on June 21, 2022, 05:57:45 PM »
Hi Mike,

Thanks for your answer! It is working now  :).
Pages: 1 [2] 3 4 ... 10