PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Problem with filling grid  (Read 1563 times)

Jelle

  • New Member
  • *
  • Posts: 2
    • View Profile
Problem with filling grid
« on: June 20, 2022, 04:48:03 PM »
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.

Code: [Select]
! 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

Code: [Select]
[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

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Problem with filling grid
« Reply #1 on: June 20, 2022, 05:10:33 PM »
The program=xxx specified on the grid is called and not performed thus your logic should probably be:

Code: [Select]
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
« Last Edit: June 20, 2022, 05:34:02 PM by Mike King »
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Jelle

  • New Member
  • *
  • Posts: 2
    • View Profile
Re: Problem with filling grid
« Reply #2 on: June 21, 2022, 05:57:45 PM »
Hi Mike,

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

Mike King

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Problem with filling grid
« Reply #3 on: June 27, 2022, 10:34:34 AM »
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:

Code: [Select]
[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.
« Last Edit: July 26, 2022, 04:30:27 PM by Mike King »
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com