PxPlus User Forum

Twitter Twitter Twitter

Author Topic: grid display using program - grid does not show  (Read 806 times)

Jon Toomsen

  • Silver Member
  • ***
  • Posts: 24
    • View Profile
grid display using program - grid does not show
« on: February 01, 2024, 07:49:51 PM »
<!DOCTYPE html>
<html>
<head>
</head>
<body>
[ttl]Grid[/ttl]<br>
[grid MyGrid program="myprog.pxp;makegrid" size=auto/20 ]
[col Source=ItemCode$ ttl="ItemCode" width=30 ]
[col Source=ItemName$ ttl="Name" width=50]
[col Source=ItemType$ ttl="Type" width=2]
[/grid]
</body>
</html>



! myprog.pxp
 MAKEGRID:
 OPEN (HFN,IOL=GRIDIOL)"*memory*"
 LET MYGRID=LFO
 SELECT * FROM INTERNETITEM
 WRITE (MYGRID)
 NEXT RECORD
 EXIT
 GRIDIOL:IOLIST ITEMCODE$,ITEMNAME$,ITEMTYPE$
 !



Devon Austen

  • Administrator
  • Diamond Member
  • *****
  • Posts: 382
  • Don’t Panic
    • View Profile
    • PVX Plus Technologies
Re: grid display using program - grid does not show
« Reply #1 on: February 02, 2024, 09:10:03 AM »
Hi Jon,

When debugging a Webster issue the first step is to hover over the red highlighted section on the page. The tool tip will give you error information which will help you figure out your issue.

I believe your issue is that your page does not have a [form] and the grid needs to be in a [form].

You also need to add

ENTER MYGRID

right under the MAKEGRID: line

This is how the grid program can pass back the handle to the grid memory file.

So try this:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
[ttl]Grid[/ttl]<br>
[form]
[grid MyGrid program="myprog.pxp;makegrid" size=auto/20 ]
[col Source=ItemCode$ ttl="ItemCode" width=30 ]
[col Source=ItemName$ ttl="Name" width=50]
[col Source=ItemType$ ttl="Type" width=2]
[/grid]
[/form]
</body>
</html>



! myprog.pxp
 MAKEGRID:
ENTER MYGRID
 OPEN (HFN,IOL=GRIDIOL)"*memory*"
 LET MYGRID=LFO
 SELECT * FROM INTERNETITEM
 WRITE (MYGRID)
 NEXT RECORD
 EXIT
 GRIDIOL:IOLIST ITEMCODE$,ITEMNAME$,ITEMTYPE$

Normally you would have a program= in the [form] to specify the program to run when form is submitted and that would handle any events on the page.

For information on the use of the form see here:
https://manual.pvxplus.com?Webster/Webster%20Application%20Design.htm

For the need for the ENTER you can see the program= short code documentation here: https://manual.pvxplus.com?Webster/Short%20Code%20Options.htm

It looks like we need to update the example on the Using Grids in Webster+ documentation page to include the ENTER statement as that is missing.
Principal Software Engineer for PVX Plus Technologies LTD.

Jon Toomsen

  • Silver Member
  • ***
  • Posts: 24
    • View Profile
Re: grid display using program - grid does not show
« Reply #2 on: February 02, 2024, 02:10:05 PM »
[form] was needed now a shell of the grid is shown.

Now I have internetitem not found in dictionary.
have tried both ways - program= and the execute statement

I have an application library under the prog folder.
The query for internetitem works.

.

Devon Austen

  • Administrator
  • Diamond Member
  • *****
  • Posts: 382
  • Don’t Panic
    • View Profile
    • PVX Plus Technologies
Re: grid display using program - grid does not show
« Reply #3 on: February 02, 2024, 02:54:40 PM »
Is the channel number for a open file in the variable INTERNETITEM of is the name of the file INTERNETITEM. If that is the name of the file you are just missing quotes in the select statement

i.e.

SELECT * FROM "INTERNETITEM"
Principal Software Engineer for PVX Plus Technologies LTD.

Jon Toomsen

  • Silver Member
  • ***
  • Posts: 24
    • View Profile
Re: grid display using program - grid does not show
« Reply #4 on: February 02, 2024, 03:19:15 PM »
added quotes - it is not a channel no ( was a typo earlier )

Jon Toomsen

  • Silver Member
  • ***
  • Posts: 24
    • View Profile
Re: grid display using program - grid does not show
« Reply #5 on: February 10, 2024, 10:29:02 AM »
Get the shell of the grid - column titles but the grid is not populated.
Nothing in red is displayed

Devon Austen

  • Administrator
  • Diamond Member
  • *****
  • Posts: 382
  • Don’t Panic
    • View Profile
    • PVX Plus Technologies
Re: grid display using program - grid does not show
« Reply #6 on: February 12, 2024, 08:05:38 AM »
Does the file INTERNETITEM have records in it?

Does the fields defined for INTERNETITEM match the IOL used in your program?
Principal Software Engineer for PVX Plus Technologies LTD.

Mike King

  • Diamond Member
  • *****
  • Posts: 3803
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: grid display using program - grid does not show
« Reply #7 on: February 12, 2024, 10:59:36 AM »
I tried the following with no problem:

HTML file demo.html (placed in the pages directory):

Code: [Select]
<!DOCTYPE html>
<html>
<head>
</head>
<body>
[ttl]Grid[/ttl]<br>
[form]
[grid MyGrid program="myprog;makegrid" size=auto/20 ]
[col Source=ItemCode$ ttl="ItemCode" width=30 ]
[col Source=ItemName$ ttl="Name" width=50]
[col Source=ItemType$ ttl="Type" width=5]
[/grid]
[/form]
</body>
</html>

Program file "myprog" (in the prog directory)

Code: [Select]
! myprog (placed in the prog directory)
MAKEGRID:
  enter MYGRID
  open (hfn,iol=GRIDIOL)"*memory*"
  MYGRID=lfo
  while 1
  read data iol=gridiol,end=*break
  write (MYGRID)
  wend
 !
  exit
 !
  data "item1","First Item","A"
  data "item2","Second Item","B"
  data "item3","Third Item","A"
  data "item4","Last Item","C"
!
 GRIDIOL:  iolist ITEMCODE$,ITEMNAME$,ITEMTYPE$

Rather than read from a file I used in-code DATA values to make sure there was data present.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Jon Toomsen

  • Silver Member
  • ***
  • Posts: 24
    • View Profile
Re: grid display using program - grid does not show
« Reply #8 on: February 12, 2024, 02:09:41 PM »
this is what I get using html and prog - see attached
</span><br /><span>   </span><br /><span>   </span><br /><span>
</span><br /><span>   </span><br /><span>   </span><br /><span>
</span><br /><span>   </span><br /><span>   </span><br /><span>
</span><br /><span>   </span><br /><span>   </span><br /><span>

Jon Toomsen

  • Silver Member
  • ***
  • Posts: 24
    • View Profile
Re: grid display using program - grid does not show
« Reply #9 on: February 12, 2024, 04:12:41 PM »
html and program
[ttl]Grid[/ttl]
[form]
[grid MyGrid program="myprog;makegrid" size=auto/20 ]
[col Source=ItemCode$ ttl="ItemCode" width=30 ]
[col Source=ItemName$ ttl="Name" width=50]
[col Source=ItemType$ ttl="Type" width=5]
[/grid]
[/form]

! myprog (placed in the prog directory)
 MAKEGRID:
  enter MYGRID
  open (hfn,iol=GRIDIOL)"*memory*"
  let MYGRID=lfo
  while 1
  read data iol=GRIDIOL,end=*break
  write (MYGRID)
  wend
 !
  exit
 !
  data "item1","First Item","A"
  data "item2","Second Item","B"
  data "item3","Third Item","A"
  data "item4","Last Item","C"
 !
 GRIDIOL:
  iolist ITEMCODE$,ITEMNAME$,ITEMTYPE$
 !