Results 1 to 8 of 8

Thread: can i use cursor in to a grid section

  1. #1
    Member
    Join Date
    Feb 2015
    Posts
    36

    can i use cursor in to a grid section

    can i use cursor in to a grid section, because i cant change de database or table in details of section.

    Regards

  2. #2
    Member
    Join Date
    Feb 2015
    Posts
    36
    no answer?

  3. #3
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,221
    A dynamic grid like that which is not bound to a fixed data source cannot be related from a parent section or have child sections as it is not constant.

    So if you want to dynamically have a grid on a dynamically chosen table or query then use a custom section.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  4. #4
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,068
    Hi,

    what is your USE CASE? There are at least two ways I've used to handle use cases where in VFP one might have used a temporary cursor.

    Hank

  5. #5
    Senior Member
    Join Date
    Jul 2013
    Location
    Ontario, Canada
    Posts
    658
    Hello,

    As Hank pointed out to me quite a while back, it is possible to change both the database and table for a section, even if it's grayed out.

    For a form/grid/webview etc. section named mysection, use the console and issue: lianja.get("mysection").database = "mynewdatabase" Next: save the app and refresh it. You will see the new database name has been saved. Similary for the table (or anything else).

    Cory

  6. #6
    Member
    Join Date
    Feb 2015
    Posts
    36
    I need use temporaly file at grids, for capture invoice details and this temporaly file is only used for one user in multiuser environment.

  7. #7
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    6,221
    If you take a look at the canvas demo example it shows you how to do that without using a temporary table. You can just add rows to the grid and recalc subtotals and grand totals.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  8. #8
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,068
    Hi,

    I had a situation where I wanted to populate a grid with a cursor that I had generated; allow the user to edit the data; and have data rules applied from the data dictionary.

    What I did was create a table that had a special field in it, cFilterExp C(36). When the user went to the page where that grid resided, I used guid() to create a guid, created the rows in the table which was shared by all users, put the guid() in the cFilterExp of each row, and set the filter of the section to that same guid() value. When the page was used with new data, a routine deleted the records from the table based on the old guid(), etc.

    I like working with tables/cursors much more than manually adding data to a grid, and having a real cursor gave me the ability to use dbf() to append the data to the real table. It was actually pretty efficient.

    That was a desktop app (from 2 years ago). I'll have to convert that to a web app when I have some time, to see if there are any kinks in that scheme when working from a JavaScript client. I think not, but until you've done it, you don't really know. Such is the nature of complex systems.

    enjoy,

    Hank

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us