PxPlus User Forum

Twitter Twitter Twitter

Recent Posts

Pages: [1] 2 3 ... 10
1
Programming / Re: JSON from Array with numeric and string
« Last post by Loren Doornek on March 27, 2024, 01:37:42 PM »
Thanks for that tip, Stéphane - that's new to me! 

Unfortunately, we have a lot of clients on PXP12, and the DIM CLASS doesn't work on that version since it wasn't added until PxPlus 2016.  I tried it on later versions, and it works well, and is easier to manage than building a string of elements for use with the WITH NUM clause of the DIM.  I typically use the WITH NUM clause, which I described on the other duplicate post in this forum.  But, going forward, I'll probably start using this DIM CLASS instead.
2
Programming / Re: JSON from Array with numeric and string
« Last post by Loren Doornek on March 27, 2024, 01:24:42 PM »
Here is a better example, which uses a comma-delimited list of the JSON elements that should be numeric.

0010 BEGIN
0020 LET arr$["string"]="123"
0030 LET arr$["numeric"]="123",withnum$+="numeric,"
0040 LET arr$["this.is.a.string"]="456"
0050 LET arr$["this.is.a.number"]="456",withnum$+="this.is.a.number,"
0060 PRINT "Withnum$= ",withnum$
0070 PRINT DIM(LIST EDIT arr${ALL} WITH NUM(withnum$))

run

Withnum$= numeric,this.is.a.number,
{
  "string":"123",
  "numeric":123,
  "this":{
    "is":{
      "a":{
        "string":"456",
        "number":456
      }
    }
  }
}
3
Programming / Re: JSON from Array with numeric and string
« Last post by Loren Doornek on March 27, 2024, 01:16:32 PM »
Use the "with num" option for JSON to specify which values are numeric.  Below is an example.

arr$["string"]="123"
arr$["numeric"]="123"
print dim(list edit arr${all} with num("numeric"))

{
  "string":"123",
  "numeric":123
}
4
Programming / Re: JSON from Array with numeric and string
« Last post by Stéphane Devouard on March 27, 2024, 12:44:59 PM »
Hi Cedric

Check out the DIM CLASS directive : https://manual.pvxplus.com/PXPLUS/directives/dim_class.htm

Hope this helps
5
Programming / JSON from Array with numeric and string
« Last post by Cedric on March 27, 2024, 12:12:59 PM »
Hi,

I'm wondering if there was a way I could "force" a json value to be a numeric when the Array is set to string.   I have a case where I need to send the data in a specific format for the end user (not pvx) who uses variable types.

So my data is all sent as if they were string, but I'd like one specific value to be without quotation mark, so as a numeric value.

I thought that maybe there was a prefix I could put before the value so that PVX would recognize it as a numeric for the end result of :

"value": 1,

instead of

"value": "1",


6
Programming / JSON from Array with numeric and string
« Last post by Cedric on March 27, 2024, 12:02:48 PM »
Hi,

I'm wondering if there was a way I could "force" a json value to be a numeric when the Array is set to string.   I have a case where I need to send the data in a specific format for the end user (not pvx) who uses variable types.

So my data is all sent as if they were string, but I'd like one specific value to be without quotation mark, so as a numeric value.

I thought that maybe there was a prefix I could put before the value so that PVX would recognize it as a numeric for the end result of :

"value": 1,

instead of

"value": "1",


7
Programming / Re: accessing mySQL-DB
« Last post by EVa on March 26, 2024, 05:08:25 AM »
A temporary work-around is to downgrade the mariadb3 package to version 3.1.13-3.30.1 - the PxPlus MYSQL interface works correctly with that version.
8
Programming / Re: accessing mySQL-DB
« Last post by EVa on March 26, 2024, 04:54:28 AM »
PvxPlus Technologies is looking into this.
9
Language / Re: ERROR 302 file not found
« Last post by Stéphane Devouard on March 25, 2024, 04:24:12 PM »
Hi

HTTP error 302 is not a file not found error but a redirect status

You should use the *plus/web/request http client instead, which will follow redirections

Regards
10
Language / Re: ERROR 302 file not found
« Last post by edjack on March 25, 2024, 03:40:51 PM »
Does it work if you actually include the filename in the URL?

it does not work if i use the file name.
Pages: [1] 2 3 ... 10