PxPlus User Forum

Twitter Twitter Twitter

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Stéphane Devouard

Pages: 1 [2] 3 4 ... 9
16
Programming / Re: Syntax error in IF with string expressions
« on: March 13, 2023, 12:26:07 PM »
I usually use nul(string$) or not(nul(string$))

I usually avoid complex conditions with nested IF ELSE and { }

Even in languages that have fancy IDEs with indentation and code folding, developers recommend using "guards"
ie simple IFs to prematurely exit from a given process or function

I often use
Code: [Select]
for (some condition)
! // do the work
next


Or if there are more conditions to test
Code: [Select]
for (1)
if (some condition) then break
if (some other condition) then break
! // lets do the work
next

Anyway, thanks guys for your input

17
Programming / Syntax error in IF with string expressions
« on: March 13, 2023, 04:28:01 AM »
Hi
My boss found the issues in the attached image while doing some code

I've tried some variations with parentheses to transform variables into values but still getting the error 20

18
Wish List / Re: An updated Eclipse Plugin
« on: January 11, 2023, 11:57:08 AM »
… or a VS Code extension ;)

19
Programming / Re: Apache HTTP Interface
« on: January 07, 2023, 02:26:14 AM »
Hi
Up to 4 years ago, the Apache interface used to be compatible with IIS as well and there were some information about it in the « Running on the web » section of the doc IIRC.
It looks like this information has been moved to the Webster+ docs at
https://manual.pvxplus.com/PXPLUS/Webster/Webster%20Setup.htm#iis_setup
Basically you need to create a CGI handler for the .pxp file extension in IIS, and give all you web-based programs this common extension, and you should be good to go.
Hope this helps

20
Programming / Re: Passing a COM Object to a CMD
« on: November 18, 2022, 06:17:49 AM »
Hi Jeffrey

When you do
PO EXCEL_OBJ

ProvideX does a CALL to *cmd/PO and passes it whatever you've type after PO as a string
So in PO you need to do
ENTER args$

And if you check args$ you'll see that it has been loaded with " EXCEL_OBJ"
So there is not much you can do with it as your EXCEL_OBJ variable is available in the calling context only, not in your called *cmd program

However, you may want to check out the *cmd/system/tlb CLI program and borrow its first few lines of code which do basically what you want to achieve

Hope this helps

21
Language / *obj/xml issue
« on: October 11, 2022, 03:59:41 AM »
Hi

There is a minor issue in *obj/xml with the find_node() method

Code: [Select]
-}x=new("*obj/xml","<prestashop><products><product><id>1</id></product></product
s></prestashop>")
-}
-}xpath$="prestashop/products/product/id"
-}? x'find_node(xpath$)'value$
1
-}?xpath$
prestashop

I can work around by sending the parameter by value with parentheses or as an expression such as xpath$+""

But I think it should be handled in the method itself by protecting the _tag$ input parameter

TIA

22
Programming / Addressing an object
« on: September 28, 2022, 10:46:08 AM »
Hi

This code returns an error 29 on line 581


Code: [Select]
0580 IF XL[J]=0 THEN XL[J]=NEW("*obj/xml")
0581 XLIG=XL[J]'ADD_NODE("ligne")

I told the boss to change it to :

Code: [Select]
0580 if xl[j]=0 xd=new("*obj/xml"); xl[j]=xd else xd=xl[j]
0581 xlig=xd'add_node("ligne")

And it worked

Looks like this type of syntax
Code: [Select]
array[index]'some_method() While valid, is not supported by the parser or compiler

That being said, we are on a V16 with V15 license, maybe it has been fixed in a more recent version ?

Regards

23
Nomads / Re: NOMADS in Linux
« on: July 30, 2022, 01:58:24 PM »
Skip

If you are using WindX from your Windows workstation to connect to your Linux server, then everything you do, create, edit is on the Linux server. Run the IT editor, do a File > Open, and you will see the directory tree of your Linux server, not your workstation. WindX is just a smart terminal here, which happens to run on a local version of PxPlus for Windows. More precisely, a thin client for your PxPlus host.

At my new job, everyone is using Chromebooks or Chromeboxes and run the internal applications via the Chrome browser using a ssh client extension, since the internal apps are all CHUI-based and running on Linux. However since I have been using a PC for the last 30 years or so, I have setup a simple cs host and I am using WindX to do my development work. I also intend to setup the WebIDE for my boss to be able to have some code colorization after decades using *e :)

24
Nomads / Re: NOMADS in Linux
« on: July 29, 2022, 02:44:13 AM »
Skip

Run a PxPlus prompt from WindX
Make sure your START_UP and any other initialization routine requred ti setup your runtime environment has executed, as it will make your life easier
Type ide at the console
Here you go, you have now access to all the tools of the PxPlus Development -- graphical editors (*IT and ED+), Nomads Designer, Data Dictionary Maintenance, etc

Regards,





25
Programming / Re: error handling in objects
« on: July 18, 2022, 06:36:50 AM »
Peter

If you have a common ERROR_HANDLER, maybe you could modify it to detect if _OBJ<>0 which means you are running in an object context
You could then caputre some of the ERR() values in local properties that would be declared in base class with error management routines that you would have to inherit in all your other classes
As for TRY and EVN/EVS encapsulation, have you also checked the TRY() function which can also intercept errors and return default values ?

Hope these general thoughts will help

26
Language / Re: Json element class
« on: July 12, 2022, 10:58:13 AM »
Michael

Unless there are some undocument features in PxPlus JSON support via associative array, I have bad news : you must provide all the array keys that have numeric values in the with num() clause

PxPlus JSON support is great but it lacks some helper functions, especially in the area of JSON arrays
Something like DIM(READ NUM(json$["po.order_items."]) would be nice to count the number of elements in the order_items[] array
As well as being able to specify something like "po.order_items.{*}.price" in the with num() clause

Regards

27
Programming / Re: Loading a json pre version 11
« on: July 03, 2022, 03:54:38 AM »
Michael (Greer)

If this is on Windows, you can use an ActiveX/COM object to parse the JSON
The libraries from Chilkat software are good -- we used the Chilkat ZIP at a prior job, long before ZIP was directly supported by PxPlus
You just download and install their library, and register it as a ActiveX/COM class (it's all documented)
On this page : https://www.chilkatsoft.com/refdoc/activex.asp
Take a look at the documentation for the JsonObject and JsonArray classes

You also have example code for a bunch of development languages. VB6 is usually the easiest to translate to ProvideX.
https://www.example-code.com/vb6/json_array_of_objects.asp

Here is this code translate to PxPlus
Code: [Select]

0001 !
0002 BEGIN
0003 !
0004 LET JSON$="{""employees"":[{""firstName"":""John"", ""lastName"":""Doe""},{""firstName"":""Anna"", ""lastName"":""Smith""},{""firstName"":""Peter"",""lastName"":""Jones""}]}"
0005 !
0006 DEF OBJECT JSON,"Chilkat_9_5_0.JsonObject"
0007 !
0008 JSON'LOAD(JSON$)
0009 !
0010 LET EMPLOYEES=JSON'ARRAYOF("employees")
0011 DEF OBJECT EMPLOYEES
0012 !
0013 LET EMPLOYEES_COUNT=EMPLOYEES'SIZE
0014 LET EMPLOYEE_NR=0
0015 WHILE EMPLOYEE_NR<EMPLOYEES_COUNT
0016 !
0017 LET EMPLOYEE=EMPLOYEES'OBJECTAT(EMPLOYEE_NR)
0018 DEF OBJECT EMPLOYEE
0019 !
0020 PRINT EMPLOYEE'STRINGOF$("firstName")," ",EMPLOYEE'STRINGOF$("lastName")
0021 !
0022 DROP OBJECT EMPLOYEE,ERR=*NEXT
0023 EMPLOYEE_NR++
0024 WEND
0025 !
0026 DROP OBJECT EMPLOYEES,ERR=*NEXT
0027 DROP OBJECT JSON,ERR=*NEXT
0028 !
0029 STOP

And this is the result :
Code: [Select]
->run
John Doe
Anna Smith
Peter Jones
->

And the best news : these two classes do not require you to purchase a license from Chilkat, they are free to use :)

Hope this helps !

28
Nomads / Re: Messed up IT Editor after upgrade to 18.20
« on: June 24, 2022, 12:12:49 PM »
Did you update both the server and the client to the same PxPlus version ?

29
Language / Re: Json Element addressing
« on: May 25, 2022, 01:55:09 AM »
Loren


Your version is more generic.
Guess our lives would be simpler if PxPlus had a flavour of the dim(read num(array)) that would count the number of elements in a json array converted to a hash table. Maybe something like count=dim(read num(array[$],key="…"))


Regards

30
Language / Re: Json Element addressing
« on: May 24, 2022, 01:27:26 PM »
Michael
I think I found the missing dot between the moment you copied and tested the code and the moment you posted your answer ;-)
Glad I could help

Pages: 1 [2] 3 4 ... 9