Database Strategy

Pete pete at mollysrevenge.com
Wed Nov 16 17:01:28 EST 2011


Yes, that is strange.  I did find this in the datagrid manual:

 "When a Data Grid renders it dynamically creates fields and accesses
certain properties. Some of these properties can not be properly reported
by the Revolution engine unless the field is on an open card."

Your code is in OpenCard so this probably isn't the problem, but.....??

Pete
Molly's Revenge <http://www.mollysrevenge.com>




On Wed, Nov 16, 2011 at 1:05 PM, Michael Doub <mike at doub.com> wrote:

> The potential size of the database is causing me to drive the database by
> loading the data grid by catching
> command GetDataForLine pLine, @pOutData.
>
> On the first execution thru the OpenCard handler everything works just
> fine.  On subsequent
> calls the OpenCursor routine is never executed.  The handler seems get as
> far as the
>
> set the dgProp[ "show vscrollbar" ] of group "DataGrid" to true  that
>
> statement where it would appear that that the OpenCard handler is
> terminated.   If I make
> the setup_Scrolling code a comment, then everything works as as I would
> have expected.
> it is really odd that the same code executes fine on the first execution.
>   Could this be a bug
> in the data grid code?  I am using 5.0.1 (rc 1)
>
>
> on OpenCard
>   log ("Open Card")
>   set the tmLabel of group "Header" of this card to the short name of this
> card
>   setup_Scrolling
>   OpenCursor
>   put revDatabaseColumnNames(sCursorID) into sRecordFields
>   put revNumberOfRecords(sCursorID) into sRecordCount
>   lock screen
>   set the dgNumberOfRecords of group "DataGrid" to sRecordCount
>   unlock screen
> end OpenCard
>
> on setup_Scrolling
>   if the environment is "mobile" then
>      set the dgProp[ "show vscrollbar" ] of group "DataGrid" to false
>      -- other code remove for now
>   else
>      set the dgProp[ "show vscrollbar" ] of group "DataGrid" to true
>   end if
> end setup_Scrolling
>
>
>
> On 2011-11-16, at 1:04 PM, Pete wrote:
>
> > Sounds like the problem is that you close the cursor when the card is
> > closed.  From that point, it's not a valid cursor, as you're finding when
> > you return to the card.  When you return to the card, you'd need to
> either
> > leave the cursor open or re-execute the SELECT statement that created it.
> >
> > Depending on the needs of your application, you might want to consider
> > not creating a cursor but returning the data from the SELECT statement
> > directly to your application using revDataFromQuery and storing that in a
> > custom property.  That's useful if you are using a datagrid on your card
> > since you can simply set the dgtext of the datagrid to the returned data
> to
> > populate the datagrid.
> >
> > Pete
> > Molly's Revenge <http://www.mollysrevenge.com>
> >
> >
> >
> >
> > ________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>



More information about the use-livecode mailing list