Loading list from program carList$

Started by Jon Toomsen, January 30, 2024, 10:50:32 AM

Previous topic - Next topic

Jon Toomsen

!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

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:

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:

<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

Thanks Mike.  We will update the doc.
PVX Plus Technologies, Ltd.