« Return to Thread: Advice NOT 4D

new to Batch ...

by Raimon Fernandez Sirera-2 :: Rate this Message:

Reply to Author | View in Thread

Hello,

After more than one year working without Active4D, we have to add some  
new functionality to some of our existing web pages ...


Before using Batch, we simply issue a query and create a RowSet:

        $rs := RowSet.newFromSelection(->[FORMALITZACIO]; $map)


Now, after reading the docs, I see that I can create a Batch from an  
existing RowSet or from a Selection.

After creating the batch, we need another RowSet with the current  
calues of the batch,

And, in the final page, just loop through this new RowSet.

Is this the correct way ?

Because while I was playing, I'm having some errors, like:


/Macintosh HD/Users/Rai/Desktop/Web BS/Web/0081/list_batch.a4d [main] 19
/Macintosh HD/Users/Rai/Desktop/Web BS/Active4D/Batch.a4l  
batch.newFromSelection 1
/Macintosh HD/Users/Rai/Desktop/Web BS/Active4D/Batch.a4l batch._init 1
if (is a collection($inSize)) | (is an iterator($inSize))
Expecting a numeric expression.





What I'm doing wrong here ?

<%
        import("RowSet")
        import("Batch")
       
        $map := """
        id: [FORMALITZACIO]ID_Formalitzacio;
        oficina:[FORMALITZACIO]OFICINA_ID;
        sol_licitant:[FORMALITZACIO]INTERESSAT_PRAL;
        data_inici:[FORMALITZACIO]DATA_CREACIO;

        ultim_moviment:[FORMALITZACIO]DATA_CREACIO;
        estat:[FORMALITZACIO]Entitat_ID;


        """
        ALL RECORDS([FORMALITZACIO])
        REDUCE SELECTION([FORMALITZACIO];100) // testing purposes
       
        $rs := RowSet.newFromSelection(->[FORMALITZACIO]; $map)



// Make the batch using defaults
$attributes:=""
$batch := Batch.newFromSelection(->[FORMALITZACIO];$attributes) //  
here is where Active4D throughs the error
$batch.setDefaults

...


// Now make the RowSet from the subset of rows in the batch
$rs_batch := RowSet.newFromSelection(->[FORMALITZACIO];  
$map;'$batch{"start"}:$batch{"end"}')
// Setup the link info, make the links
c_text($prev; $batches; $next)
$needBatch := $batch->makePageLinks($prev; $batches; $next;$attributes)
if ($rs->rowCount > 0)
%>

....



I think I'm confused of default attributes for batch ...


thanks for your help,


regards,


raimon fernandez



_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

 « Return to Thread: Advice NOT 4D