PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Loading list from program carList$  (Read 1127 times)

Jon Toomsen

  • Silver Member
  • ***
  • Posts: 24
    • View Profile
Loading list from program carList$
« on: January 30, 2024, 10:50:32 AM »
!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>[ttl]Cars[/ttl]</p>
<p>[form]</p>
<p>[list Cars$ program=myprog;makecarlist][data rowsep=/]carList$[/data][/list] <br />[list Cars2$][data rowsep=/]Ford/Gm/Audi/Volvo[/data][/list] [/form]</p>
</body>
</html>

Program myprog

MAKECARLIST:
CARLIST$="Ford/Gm/Audi/Volvo/"
EXIT

Mike King

  • Diamond Member
  • *****
  • Posts: 3818
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Loading list from program carList$
« Reply #1 on: January 30, 2024, 11:37:50 AM »
According to the documentation:

When used on a [ list ] short code, indicates the name of a program to be performed called to return a file containing the data to be displayed.
The documentation has a minor error in that it says performed whereas it should say called.

So when you have a program=xxxxx in a list shortcode, the program should return a file handle to a keyed file with the desired contents.  Generally this would be a memory file, but id could be a *query* file or actual data file.  Something like:

Code: [Select]
MakeCarList:
 enter FileNo
 open (hfn) "*memory*"
 FileNo = lfo
 write (lfo,key="0") "Ford"
 write (lfo,key="1") "GM"
 write (lfo,key="2") "Audi"
 write (lfo,key="3") "Volvo"
 exit

The Key value will determine the sort sequence.  You will generally provide a IOLIST on the file then use the [ col ] short code to reference the desired columns. 

Normally you would have a file on your system with the car models and simply open and pass back this file then define which column/field you want displayed.

Now if you do want to use a program and a text string you could use something like:

Code: [Select]
<p>[ttl]Cars[/ttl]</p>
<p>[form]</p>
<p>[execute perform"myprog;makecarlist"][list Cars$][data rowsep=/ text=(carList$)][/list]<br />
[list Cars2$][data rowsep=/]Ford/Gm/Audi/Volvo[/data][/list]
[/form]
</p>

Use the Execute to run your program to load carlist$ and the text= option in the [ data ] short code to pass the value.  When you use the text= option, there is no [ /data ] needed.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Len Vassos

  • Administrator
  • Gold Member
  • *****
  • Posts: 94
    • View Profile
Re: Loading list from program carList$
« Reply #2 on: January 30, 2024, 12:03:41 PM »
Thanks Mike.  We will update the doc.
PVX Plus Technologies, Ltd.