Problem with filling grid

Started by Jelle, June 20, 2022, 04:48:03 PM

Previous topic - Next topic

Jelle

Hi,

I am for the first time using Webster+ and have some problems to fill a grid.
I have followed the steps from the documentation but no grid is showing in the browser.

Showing in browser
[grid MyGrid program=MijnPaarden.pxp;MaakGrid size=auto/20]
(Error: No grid control file found in MyGrid or opened by program.

! MijnPaarden.pxp
!
!
MaakGrid:
LET paarden=UNT; OPEN (paarden,IOL=*)"paarden.dat"
LET MyGrid=UNT; OPEN (MyGrid,IOL=IOL(paarden))"*memory*"
SELECT * FROM paarden
WRITE (MyGrid)
NEXT RECORD
EXIT


[ttl]Mijn paarden[/ttl]

[form program=MijnPaarden.pxp]

[grid MyGrid program=MijnPaarden.pxp;MaakGrid size=auto/20]
[col source=Naam$ ttl="Naam" width=30]
[col source=Fokker$ ttl="Fokker" width=30]
[col source=Eigenaar$ ttl="Eigenaar" width=30]
[/grid]

[/form]


I think it should work like this.

Mike King

#1
The program=xxx specified on the grid is called and not performed thus your logic should probably be:

MaakGrid:
enter MyGrid
LET paarden=UNT; OPEN (paarden,IOL=*)"paarden.dat"
LET MyGrid=UNT; OPEN (MyGrid,IOL=IOL(paarden))"*memory*"
SELECT * FROM paarden
WRITE (MyGrid)
NEXT RECORD
EXIT


It appears the help file documentation is incorrect for this option.  It is only PERFORMed when used on a [ form ] short code.

Documentation page has been updated on the web site: https://manual.pvxplus.com/?/Webster/Short%20Code%20Options.htm#program
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Jelle

Hi Mike,

Thanks for your answer! It is working now  :).

Mike King

#3
I have attached a ZIP file to this message with a sample invoicing program that you might find helpful in understanding how to use Webster+ grids  (page name: inv, program: invoicing). 

Basically when you enter an invoice number an event loads the grid with the appropriate invoice lines.

If you look at the HTML page you will find it makes extensive use the 'usefile' option to pull in the field definitions from the standard PxPlus data dictionary.  This allows you to change things such as field sizes, validation rules, and prompts in the data dictionary, and have them immediately reflected on the HTML page.

For example for the Client name we coded:

[row "\[show usefile field=ClientName$\]:"][input ClientName$ usefile][/row]

This defined a row on the page with a prompt generated from a [show] whose text was sourced from the data dictionary ClientName element, and an input field also sourced from the definition of that element.  Doing this also automatically included not only the field definition but also the queries associated with the fields.

The page also defines an event tied to changing the Client number which would reload the client information along with three calculated fields to be automatically updated locally by the browser.


You should be able to run this demo by using the *webster/install program to create a Webster+ setup directory then unzipping the attached ZIP file into that directory.  It has been tested on v18.20 and v19.00.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com