I'm seeing some strange behaviour when building 3 distinct rowsets in a single page. It appears that each rowset and its map methods is being called more times than there are records selected.

For example take the following code:

    $map := """
        imageURL:            `idp.utils.GetThumbnailURlForImage`;
        imageRecnum:        `record number([Images])`;
    """

    C_longint($rowSet)
$imageRowSet := RowSet.newFromSelection(->[Images];$map) ` Don't need callback

So despite only 2 image records being loaded, the image map method gets called 13 times. Catalogue Entry gets called 3 times but for only 1 record. Bibliography gets called 5 times for 3 records.

There are a few things happening here:

- When a newFromSelection RowSet is created, the row getter is called to fill the row cache with the values for an empty record. I have to do this because there is no way for me to know what the type is for a column expression without executing it. That accounts for one extra call to the column expression.

- If you are using RowSet.next to iterate through the RowSet, the last call to next will move to the record after the last, again loading empty values into the row cache. That accounts for one more extra call. So that explains the second two cases.

If you want to avoid the extra call at the end, don't use RowSet.next, instead use a for loop and call gotoRow.

As for why idp.utils.GetThumbnailURlForImage is being called so many times, the only explanation I can offer is that you must be iterating over the RowSet more than once. Are you using findRow?

Regards,

   Aparajita
   www.aparajitaworld.com

   "If you dare to fail, you are bound to succeed."
   - Sri Chinmoy   |   www.srichinmoylibrary.com


_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to