NetTalk Central

Author Topic: Unkown list of parameters  (Read 2715 times)

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Unkown list of parameters
« on: January 08, 2012, 11:28:39 PM »
Hi,

I have a page that receives any number of parameters. For the purposes of the page the names of the parameters are not fixed and unknown at comile time. One way to get hold of all of the parameters in runtime is to use an XML parameter and step through the nodes to get to the parameters. But another solution could be to use the value queue. The only methods that I can find are SetValue and GetValue. There is nothing available as a method (or even a queue structure) that allows me to pick up the individual names and values of the parameters, Is there a way to get to the complete parameter list in the value queue, or should I stick to XML?

Thys

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Unkown list of parameters
« Reply #1 on: January 08, 2012, 11:49:55 PM »
The structure of the queue is defined in NetAll.Inc.

NetWebServerLocalDataQueueType        Queue,type
Name                                    string (80)
Value                                   string (Net:ValueSize)
Picture                                 cstring (32)
ValueFormatted                          byte
ValueExists                             byte
ExtValue                                &String
ExtValueSize                            Long
ExtValueLen                             Long
                                      End


As you can see it contains slightly more than just the Name and Value. This is primarily because it needs to cope with data of unknown length. Most data is short, and fits into the Value field, but if it is too large then the ExtValue fields are used. In addition the value can be stored formatted or unformatted.

The name of the property in the Web is _LocalDataQueue

This means you can loop through the contents of the value queue using code something like this;

Loop x = 1 to records(p_web._LocalDataQueue)
  Get (p_web._LocalDataQueue,x)
  If p_web._LocalDataQueue.Name = ‘incoming’
    ! do whatever
  End
End


Warning: The Value queue makes use of a pointer, ExtValue, which may be (indeed will be) NULL for many queue entries. All uses of this field should be wrapped in a test and should you delete any queue entries, then make sure this field is DISPOSEd first.

if not p_web._LocalDataQueue.ExtValue &= NULL

cheers
Bruce

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: Unkown list of parameters
« Reply #2 on: January 08, 2012, 11:56:18 PM »
Thanks Bruce. It's exactly what's needed.