PxPlus User Forum

Twitter Twitter Twitter

Recent Posts

Pages: [1] 2 3 ... 10
1
Programming / Looking for PxPlus based ERP Wholesale Distribution System
« Last post by ksproul on June 24, 2022, 04:38:16 PM »
If you know of a solid ERP Wholesale Distribution System written in PxPlus, please provide contact and/or sales info.


Thanks,
Ken Sproul

2
Nomads / Re: Messed up IT Editor after upgrade to 18.20
« Last post by dlocke on June 24, 2022, 12:39:51 PM »
Yes, I also updated the Pxplus Client to 18.20,  sorry I should have included that. 
3
Nomads / Re: Messed up IT Editor after upgrade to 18.20
« Last post by St├ęphane Devouard on June 24, 2022, 12:12:49 PM »
Did you update both the server and the client to the same PxPlus version ?
4
Nomads / Messed up IT Editor after upgrade to 18.20
« Last post by dlocke on June 24, 2022, 09:50:22 AM »
Since upgrading to Pxplus 18.20 my IT Editor as constantly messing up the edit window.  (See Attached Image) .

I'm running on a CentOS Server using the IT Editor over SimpleCS  to Windows Server 2012 Remote desktop.

Anyone have a fix for this ?


5
Yes -- referencing the next element to be create in a dynamic array will cause it to be created.
6
Wish List / Re: Short-hand syntax for anonymous arrays or objects initialization
« Last post by RobL on June 23, 2022, 05:07:07 PM »
Hi James,

I get the same result as you do, but here's something interesting.

The following code doesn't work:
Code: [Select]
begin
!
dim Fld$[*]
read data from "Mike,Was,Here",sep="," to Fld${all}
print Fld$[1]," / ",Fld$[2]," / ",Fld$[3]
-:end
-:run
Mike /  /
-:

But, with the addition of a line that prints the array elements, it does.
Code: [Select]
begin
!
dim Fld$[*]
print Fld$[1],Fld$[2],Fld$[3]
read data from "Mike,Was,Here",sep="," to Fld${all}
print Fld$[1]," / ",Fld$[2]," / ",Fld$[3]
-:end
-:run

Mike / Was / Here
-:

I'm not sure why printing these elements is causing them to be created in the array, but that seems to be what's happening.

Consider the following:
Code: [Select]
begin
dim Fld$[*]
for z=1 to 3
print Fld$[z]
print dim(read num(Fld$))
next
-:end
-:run

 1

 2

 3
-:

Regards,

Rob Leighton
7
Programming / Re: Determining numbers used in an ASCII sequence.
« Last post by Mike King on June 23, 2022, 03:59:59 PM »
My question is what exactly are you looking for?

You asked how to find "the number of slots used" -- that is different than the number of potential values between the two values you provided.  How is one to know if a slot is "Used" -- is this a file and you want to know how many records exists between the two keys?

If so then just get the difference in the RNO values for these two records as in:

OPEN (1) "TheFile"
READ (1,KEY="A000ZZ")
RNO_LOW = RNO(1)
READ (1,KEY="A0010F")
RNO_HI=RNO(1)

The number of USED slots between these two value would be the difference between the two RNO's less one.
8
Programming / Re: Determining numbers used in an ASCII sequence.
« Last post by Loren Doornek on June 23, 2022, 03:24:25 PM »
That's an interesting challenge :-) 

I wrote a function to do this by converting the input values to a decimal number, then just subtracting the two values. You may need to tweak it depending on whether you need to include the starting/ending values.  You can test it by passing in hex values, then comparing to an actual hex value. 

Here's a couple examples of running it, and the code is further below.

Test two simple Hex values:
RUN
Value 1:0A
Value 2:0F
Type for each position: H
Difference is: 5

Test two numeric values:
RUN
Value 1:123
Value 2:456
Type for each position: NNN
Difference is: 333

Test two hex values, and validate result:
RUN
Value 1:01A1
Value 2:01F1
Type for each position: HHHH
Difference is: 80
PRINT DEC($0001A1$)
 417
PRINT DEC($0001F1$)
 497
PRNT 497-417
 80

Testing using your values:
RUN
Value 1:A000ZZ
Value 2:A001FF
Type for each position: ANNPAP
Difference is: 196

Here's the code:

Code: [Select]
0010 ! Trying to find the number of slots used between a starting and ending alphanumeric number, i.e. the number of slots used between A000ZZ and A0010F.  Positions 4 & 6 can be 0-Z, position 5 A-Z (with the exclusion of :;<=>?@)
0020 BEGIN
0030 LET type$="HHHHHH" ! Specify allowed characters for each slot.  H=Hex,N=Numbers,A=Alphanumeric,Blank=whatever default is setup in the function
0040 LET type$="ANNPAP",val1$="A000ZZ",val2$="A001FF" ! Defaults from example provided
0050 !
0060 INPUT EDIT "Value 1:",val1$
0070 INPUT EDIT "Value 2:",val2$
0080 INPUT EDIT "Type for each position: ",type$; LET type$=UCS(type$); IF POS("HNAP"^type$) THEN PRINT "Invalid Types"; GOTO *SAME
0090 !
0100 LET val1$=UCS(val1$),val2$=UCS(val2$)
0110 IF NUL(val1$) OR NUL(val2$) THEN END
0120 !
0130 LET ret1$=FNval$(val1$,type$)
0140 LET ret2$=FNval$(val2$,type$)
0150 !
0160 IF POS("ERROR"=ret1$+ret2$) THEN PRINT "Invalid Values Entered" ELSE PRINT "Difference is: "+STR(NUM(ret2$)-NUM(ret1$))
0170 END
0180 !
0200 ! ^100
0210 DEF FNval$(LOCAL val$, LOCAL type$)
0220 ! Define available characters
0230 LOCAL ret$,slots,alpha$,numer$,hex$,alphanumer$,i,val,deftype$
0240 LET alpha$="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
0250 LET numer$="0123456789"
0260 LET alphanumer$=numer$+alpha$
0270 LET hex$="0123456789ABCDEF"
0280 !
0290 ! Define maximum length of input value
0300 LET slots=6 ! Max length of input value
0310 IF LEN(val$)>slots THEN LET ret$="ERROR"; GOTO 0640
0320 !
0330 ! Define available characters for each position
0340 LET deftype$="H"; IF NOT(NUL(type$)) THEN IF POS(MID(type$,1,1)="HNAP") THEN LET deftype$=MID(type$,1,1) ! Set the default type to whatever the first specified type is, or Hex by default
0350 LOCAL DIM avlchar$[1:slots]
0360 LET avlchar${ALL}=TBL(POS(MID(type$,1,1)="HNAP"),hex$,hex$,numer$,alpha$,alphanumer$) ! Set the default allowed characters for each slot. Default is the allowed characters from the first specified column, or hex if nothing specified
0370 !
0380 ! Set the allowed characters for each slot
0390 LET type$=PAD(type$,slots,0,deftype$) ! Pad type$ to correct length using default type
0400 FOR i=1 TO slots
0410 LET avlchar$[i]=TBL(POS(MID(type$,i,1)="HNAP"),$$,hex$,numer$,alpha$,alphanumer$)
0420 NEXT i
0430 !
0440 ! Determine how much 1 unit in each slot is worth
0450 LOCAL DIM slotval[1:slots]
0460 LET slotval[slots]=1
0470 FOR i=slots-1 TO 1 STEP -1
0480 LET slotval[i]=slotval[i+1]*LEN(avlchar$[i+1])
0490 NEXT i
0500 !
0510 ! Pad the input string, and check for invalid characters
0520 LET val$=PAD(MID(val$,1,slots),slots,0,"0") ! Pad the initial value to the correct length by prefixing with zeroes
0530 FOR i=1 TO LEN(val$)
0540 IF NOT(POS(MID(val$,i,1)=avlchar$[i])) THEN LET ret$="ERROR"
0550 NEXT i
0560 IF NOT(NUL(ret$)) THEN GOTO 0640
0570 !
0580 ! Calculate the value
0590 FOR i=1 TO LEN(val$)
0600 LET val+=(POS(MID(val$,i,1)=avlchar$[i])-1)*slotval[i]
0610 NEXT i
0620 LET ret$=STR(val)
0630 !
0640 RETURN ret$
0650 END DEF
9
Programming / Re: Determining numbers used in an ASCII sequence.
« Last post by ksproul on June 23, 2022, 02:52:10 PM »
Steven,

One way to accomplish this is:

1. Create a sort file where the key is the alphanumeric number.
          direct "numbers",6

2. Write all of the possible numbers to the file.
          write ("numbers",key=number$)

3. Compute the inclusive number of slots by subtracting the index of both values and adding 1.
          slots=ind("numbers",key="A0010F")-ind("numbers",key="A000ZZ")+1

10
Programming / Determining numbers used in an ASCII sequence.
« Last post by steven.rajski on June 23, 2022, 11:29:06 AM »
Trying to find the number of slots used between a starting and ending alphanumeric number, i.e. the number of slots used between A000ZZ and A0010F.  Positions 4 & 6 can be 0-Z, position 5 A-Z (with the exclusion of :;<=>?@)
)
Pages: [1] 2 3 ... 10