ZSQL methods & results lists
Hello all, i have a ZSQL method called get_clients. i want to put the results of this method into a list called results. if i then slice that list (using the variable batch_size) i want to create a new list called results_temp which i then use for displaying the result set. here is my code: <dtml-unless batch_size> <dtml-call expr="REQUEST.set('batch_size',20)"></dtml-unless> <dtml-unless skey> <dtml-call expr="REQUEST.set('skey', 'NOM')"></dtml-unless> <dtml-unless rkey> <dtml-call expr="REQUEST.set('rkey', '')"></dtml-unless> <dtml-unless results> <dtml-call "REQUEST.set('results', [])"> <dtml-in get_clients sort=NOM> <dtml-call"results.append(_['sequence-item'])"> </dtml-in> </dtml-unless> <dtml-if expr="batch_size!=20"><dtml-var batch_size> <dtml-call "REQUEST.set('results_temp', [results[:batch_size]])"> <dtml-else>20 </dtml-if> i am a bit stuck with the following issue: i cant seem to call the field names associated with the ZSQL method. i think the problem is the way im using sequence-item, but i cant find a workaround: anyone have any suggestions? cheers, Garry +-------------------------------------------+ Garry Steedman mailto:gs@styrax.com Styrax Associates http://www.styrax.com/ "The Good Man has no shape." +-------------------------------------------+
Garry Steedman writes:
i have a ZSQL method called get_clients.... <dtml-unless results> <dtml-call "REQUEST.set('results', [])"> <dtml-in get_clients sort=NOM> <dtml-call"results.append(_['sequence-item'])"> </dtml-in> </dtml-unless>
<dtml-if expr="batch_size!=20"><dtml-var batch_size> <dtml-call "REQUEST.set('results_temp', [results[:batch_size]])"> <dtml-else>20 </dtml-if>
i am a bit stuck with the following issue: i cant seem to call the field names associated with the ZSQL method. i think the problem is the way im using sequence-item, but i cant find a workaround: anyone have any suggestions? Unless your Z SQL method has a brain with a "__call__" method, you should be able to access the field names. Otherwise, you need to use "_.getitem('sequence-item')".
But why do you want to implement batching while "dtml-in" has it already? Dieter
participants (2)
-
Dieter Maurer -
Garry Steedman