×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

how to get data into a cursor from grid in foxpro?

how to get data into a cursor from grid in foxpro?

how to get data into a cursor from grid in foxpro?

(OP)
I have a grid as Grid1 and the columns are as below.

CODE -->

Stylecode     OrderQty     ReceiveQty
CD123         100          75
NHG345        125          125
JK87          500          200 

Now I want to do something like this. When I'm selecting a row from my grid I want to take that row data into a cursor. As an example if I select 1st Row I want to get Stylecode, OrderQty, ReceiveQty into a cursor as below.

CODE -->

Stylecode     OrderQty     ReceiveQty
CD123         100          75 

How can I do this?

Thank you

RE: how to get data into a cursor from grid in foxpro?

That could perhaps be done with a method on the OnRowColChange event.
In the snippet below I'm copying the data to a temporary table (sited in the folder
specified in m.Tempdir such as c:\temp\myapp\) but you could use a SQL statement to
put it into a cursor instead.

CODE

IF USED("myCursor")
	SELECT myCursor
	USE
ENDIF
SELECT myTable
COPY TO (m.TempDir+"myCursor") NEXT 1
SELECT 0
USE (m.TempDir+"myCursor")
SELECT myTable 

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0

RE: how to get data into a cursor from grid in foxpro?

CODE -->

Local lnRecno
lnRecno=Recno()
SELECT * FROM (Thisform.Grid1.Recordsource) WHERE RECNO() = lnRecno 

Which assumes the Grid1 is a) directly on the form and b) has an alias as recordsourcetype.

If the grid recordsourcetype is something different, please describe what it is.

Chriss

RE: how to get data into a cursor from grid in foxpro?

I do have one question, though. What is the goal of having that row in a separate cursor? You can always access the current row just by field names, I seeno need for a separate cursor.

You can also use SCATTER or SCATTER TO NAME to put the values of the current records into variables or a single object variable, which will have Stylecode, OrderQty, and ReceiveQty as properties. And such an object or single variables can be passed on to a second form, even if it has its own private data session. Besides, you could also just pass on the RECNO().

Chriss

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close