foxpro cursor size

jettero picture jettero · Jan 22, 2010 · Viewed 7.4k times · Source

This seems like such an easy problem, but I can't seem to find a solution anywhere. My co-worker and I are working on an application that makes use of the Foxpro xml dump facilities. It works great, but we're wishing to split the table into multiple files based on some size constraints.

This seems like it should be the easy part: How do you find the size of a cursor in Foxpro?

Answer

DRapp picture DRapp · Jan 23, 2010

RECSIZE() will return the length of an individual row in bytes -- that times the RECCOUNT() will give you the size. All the elements already discussed are accurate.

With respect to memo fields, if you need to know how large THEY are, you might want to add a new integer column to your table structure for "MemoLength". Then

replace all memoLength with len( alltrim( YourMemoField ))

Then, you can take the MemoLength to help determine your breakdown groups by taking this column size into consideration with the rest of you RECSIZE() * rows you want to extract out.

Additionally, you might want to run a query based on the primary key column of the table you can use as a link and do something like...

select YourPrimaryKey, len( alltrim( YourMemoField )) as MemoLength from YourTable into cursor SomeHoldingCursor readwrite

.. OR, select

into table MemSizeTable

Build an index on the MemSizeTable and you can use a join on that to get more info. This way, it won't distort your original record size, nor disrupt your original table structure, yet with a relation, you can still extract the elements you need.